import 'dart:convert';

import 'package:chat/models/im/custom_message_model.dart';

class NameCardModel extends CustomMessageModel {
  @override
  String businessID;
  String avatar;
  String userID;
  String userName;

  NameCardModel({
    this.businessID = CustomMessageType.NAME_CARD,
    required this.avatar,
    required this.userID,
    required this.userName,
  });

  factory NameCardModel.fromJson(Map<String, dynamic> json) => NameCardModel(
        businessID: json['businessID'],
        avatar: json['avatar'],
        userID: json['userID'],
        userName: json['userName'],
      );

  @override
  String toJson() => json.encode({
        'businessID': businessID,
        'avatar': avatar,
        'userID': userID,
        'userName': userName,
      });
}
