import 'package:json_annotation/json_annotation.dart';

part 'message_info.g.dart';

@JsonSerializable()
class MessageInfo {
  @JsonKey(name: 'id')
  int id;

  @JsonKey(name: 'type')
  int type;

  @JsonKey(name: 'senderId')
  String senderId;

  @JsonKey(name: 'senderPhone')
  String senderPhone;

  @JsonKey(name: 'content')
  String? content;

  @JsonKey(name: 'createTime')
  int createTime;

  MessageInfo(
      {required this.id,
      required this.type,
      required this.senderId,
      required this.senderPhone,
      this.content,
      required this.createTime});

  factory MessageInfo.fromJson(Map<String, dynamic> json) =>
      _$MessageInfoFromJson(json);

  Map<String, dynamic> toJson() => _$MessageInfoToJson(this);
}
