/// 通话信令的数据模型。
/// 与官方样板工程 openim_common 的 InvitationInfo 字段保持一致，
/// 保证和 PC 端 / 其他端互通。
class InvitationInfo {
  /// 邀请者 userID
  String? inviterUserID;

  /// 被邀请者 userID 列表，单聊只有一个元素
  List<String>? inviteeUserIDList;

  /// 群聊时为群 ID，单聊为空
  String? groupID;

  /// 房间 ID，必须唯一
  String? roomID;

  /// 邀请超时时间（秒）
  int? timeout;

  /// 发起时间
  int? initiateTime;

  /// video 或者 audio（本项目只做 audio）
  String? mediaType;

  /// 会话类型：1 为单聊
  int? sessionType;

  /// 发起方平台
  int? platformID;

  InvitationInfo({
    this.inviterUserID,
    this.inviteeUserIDList,
    this.groupID,
    this.roomID,
    this.timeout,
    this.initiateTime,
    this.mediaType,
    this.sessionType,
    this.platformID,
  });

  InvitationInfo.fromJson(Map<String, dynamic> json) {
    inviterUserID = json['inviterUserID'];
    inviteeUserIDList = json['inviteeUserIDList']?.cast<String>();
    groupID = json['groupID'];
    roomID = json['roomID'];
    timeout = json['timeout'];
    initiateTime = json['initiateTime'];
    mediaType = json['mediaType'];
    sessionType = json['sessionType'];
    platformID = json['platformID'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['inviterUserID'] = inviterUserID;
    data['inviteeUserIDList'] = inviteeUserIDList;
    data['groupID'] = groupID;
    data['roomID'] = roomID;
    data['timeout'] = timeout;
    data['initiateTime'] = initiateTime;
    data['mediaType'] = mediaType;
    data['sessionType'] = sessionType;
    data['platformID'] = platformID;
    return data;
  }
}
