// To parse this JSON data, do
//
//     final incomingCallDataPayload = incomingCallDataPayloadFromJson(jsonString);

import 'dart:convert';

class IncomingCallDataPayload {
  IncomingCallDataPayload({
    this.id,
    this.nameCaller,
    this.appName,
    this.avatar,
    this.handle,
    this.type,
    this.duration,
    this.textAccept,
    this.textDecline,
    this.textMissedCall,
    this.textCallback,
    this.extra,
    this.headers,
    this.android,
    this.ios,
  });

  String? id;
  String? nameCaller;
  String? appName;
  dynamic avatar;
  String? handle;
  dynamic? type;
  dynamic? duration;
  String? textAccept;
  String? textDecline;
  String? textMissedCall;
  String? textCallback;
  Extra? extra;
  dynamic headers;
  Android? android;
  Ios? ios;

  factory IncomingCallDataPayload.fromRawJson(String str) => IncomingCallDataPayload.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory IncomingCallDataPayload.fromJson(Map<String, dynamic> json) => IncomingCallDataPayload(
    id: json["id"],
    nameCaller: json["nameCaller"],
    appName: json["appName"],
    avatar: json["avatar"],
    handle: json["handle"],
    type: json["type"],
    duration: json["duration"],
    textAccept: json["textAccept"],
    textDecline: json["textDecline"],
    textMissedCall: json["textMissedCall"],
    textCallback: json["textCallback"],
    extra: json["extra"] == null ? null : Extra.fromJson(json["extra"]),
    headers: json["headers"],
    android: json["android"] == null ? null : Android.fromJson(json["android"]),
    ios: json["ios"] == null ? null : Ios.fromJson(json["ios"]),
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "nameCaller": nameCaller,
    "appName": appName,
    "avatar": avatar,
    "handle": handle,
    "type": type,
    "duration": duration,
    "textAccept": textAccept,
    "textDecline": textDecline,
    "textMissedCall": textMissedCall,
    "textCallback": textCallback,
    "extra": extra?.toJson(),
    "headers": headers,
    "android": android?.toJson(),
    "ios": ios?.toJson(),
  };
}

class Android {
  Android({
    this.isCustomNotification,
    this.isShowLogo,
    this.isShowCallback,
    this.isShowMissedCallNotification,
    this.ringtonePath,
    this.backgroundColor,
    this.backgroundUrl,
    this.actionColor,
    this.incomingCallNotificationChannelName,
    this.missedCallNotificationChannelName,
  });

  bool? isCustomNotification;
  bool? isShowLogo;
  bool? isShowCallback;
  bool? isShowMissedCallNotification;
  String? ringtonePath;
  String? backgroundColor;
  String? backgroundUrl;
  String? actionColor;
  dynamic incomingCallNotificationChannelName;
  dynamic missedCallNotificationChannelName;

  factory Android.fromRawJson(String str) => Android.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Android.fromJson(Map<String, dynamic> json) => Android(
    isCustomNotification: json["isCustomNotification"],
    isShowLogo: json["isShowLogo"],
    isShowCallback: json["isShowCallback"],
    isShowMissedCallNotification: json["isShowMissedCallNotification"],
    ringtonePath: json["ringtonePath"],
    backgroundColor: json["backgroundColor"],
    backgroundUrl: json["backgroundUrl"],
    actionColor: json["actionColor"],
    incomingCallNotificationChannelName: json["incomingCallNotificationChannelName"],
    missedCallNotificationChannelName: json["missedCallNotificationChannelName"],
  );

  Map<String, dynamic> toJson() => {
    "isCustomNotification": isCustomNotification,
    "isShowLogo": isShowLogo,
    "isShowCallback": isShowCallback,
    "isShowMissedCallNotification": isShowMissedCallNotification,
    "ringtonePath": ringtonePath,
    "backgroundColor": backgroundColor,
    "backgroundUrl": backgroundUrl,
    "actionColor": actionColor,
    "incomingCallNotificationChannelName": incomingCallNotificationChannelName,
    "missedCallNotificationChannelName": missedCallNotificationChannelName,
  };
}

class Extra {
  Extra({
    this.loginDetails,
    this.callerDetails,
  });

  LoginDetails? loginDetails;
  CallerDetails? callerDetails;

  factory Extra.fromRawJson(String str) => Extra.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Extra.fromJson(Map<String, dynamic> json) => Extra(
    loginDetails: json["loginDetails"] == null ? null : LoginDetails.fromJson(json["loginDetails"]),
    callerDetails: json["callerDetails"] == null ? null : CallerDetails.fromJson(json["callerDetails"]),
  );

  Map<String, dynamic> toJson() => {
    "loginDetails": loginDetails?.toJson(),
    "callerDetails": callerDetails?.toJson(),
  };
}

class CallerDetails {
  CallerDetails({
    this.userChatHistoryId,
    this.userChatHistoryLineId,
    this.contant,
    this.contantNo,
    this.currentUserId,
    this.currentUserName,
    this.targetUserId,
    this.targetUserName,
    this.encryptedTargetUserId,
    this.encryptedTargetUserName,
    this.currentUserEmail,
    this.targetUserEmail,
    this.chatEventId,
    this.fileTypeId,
    this.isSeen,
    this.isDelivered,
    this.createdDate,
    this.chatSource,
    this.conversationId,
    this.fileTypeResponse,
    this.userChatReplyResponse,
  });

  int? userChatHistoryId;
  int? userChatHistoryLineId;
  String? contant;
  String? contantNo;
  int? currentUserId;
  String? currentUserName;
  int? targetUserId;
  String? targetUserName;
  String? encryptedTargetUserId;
  String? encryptedTargetUserName;
  String? currentUserEmail;
  String? targetUserEmail;
  int? chatEventId;
  dynamic fileTypeId;
  bool? isSeen;
  bool? isDelivered;
  DateTime? createdDate;
  int? chatSource;
  String? conversationId;
  FileTypeResponse? fileTypeResponse;
  dynamic userChatReplyResponse;

  factory CallerDetails.fromRawJson(String str) => CallerDetails.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory CallerDetails.fromJson(Map<String, dynamic> json) => CallerDetails(
    userChatHistoryId: json["userChatHistoryId"],
    userChatHistoryLineId: json["userChatHistoryLineId"],
    contant: json["contant"],
    contantNo: json["contantNo"],
    currentUserId: json["currentUserId"],
    currentUserName: json["currentUserName"],
    targetUserId: json["targetUserId"],
    targetUserName: json["targetUserName"],
    encryptedTargetUserId: json["encryptedTargetUserId"],
    encryptedTargetUserName: json["encryptedTargetUserName"],
    currentUserEmail: json["currentUserEmail"],
    targetUserEmail: json["targetUserEmail"],
    chatEventId: json["chatEventId"],
    fileTypeId: json["fileTypeId"],
    isSeen: json["isSeen"],
    isDelivered: json["isDelivered"],
    createdDate: json["createdDate"] == null ? null : DateTime.parse(json["createdDate"]),
    chatSource: json["chatSource"],
    conversationId: json["conversationId"],
    fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]),
    userChatReplyResponse: json["userChatReplyResponse"],
  );

  Map<String, dynamic> toJson() => {
    "userChatHistoryId": userChatHistoryId,
    "userChatHistoryLineId": userChatHistoryLineId,
    "contant": contant,
    "contantNo": contantNo,
    "currentUserId": currentUserId,
    "currentUserName": currentUserName,
    "targetUserId": targetUserId,
    "targetUserName": targetUserName,
    "encryptedTargetUserId": encryptedTargetUserId,
    "encryptedTargetUserName": encryptedTargetUserName,
    "currentUserEmail": currentUserEmail,
    "targetUserEmail": targetUserEmail,
    "chatEventId": chatEventId,
    "fileTypeId": fileTypeId,
    "isSeen": isSeen,
    "isDelivered": isDelivered,
    "createdDate": createdDate?.toIso8601String(),
    "chatSource": chatSource,
    "conversationId": conversationId,
    "fileTypeResponse": fileTypeResponse?.toJson(),
    "userChatReplyResponse": userChatReplyResponse,
  };
}

class FileTypeResponse {
  FileTypeResponse({
    this.fileTypeId,
    this.fileTypeName,
    this.fileTypeDescription,
    this.fileKind,
    this.fileName,
  });

  int? fileTypeId;
  dynamic fileTypeName;
  dynamic fileTypeDescription;
  dynamic fileKind;
  dynamic fileName;

  factory FileTypeResponse.fromRawJson(String str) => FileTypeResponse.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory FileTypeResponse.fromJson(Map<String, dynamic> json) => FileTypeResponse(
    fileTypeId: json["fileTypeId"],
    fileTypeName: json["fileTypeName"],
    fileTypeDescription: json["fileTypeDescription"],
    fileKind: json["fileKind"],
    fileName: json["fileName"],
  );

  Map<String, dynamic> toJson() => {
    "fileTypeId": fileTypeId,
    "fileTypeName": fileTypeName,
    "fileTypeDescription": fileTypeDescription,
    "fileKind": fileKind,
    "fileName": fileName,
  };
}

class LoginDetails {
  LoginDetails({
    this.id,
    this.userName,
    this.email,
    this.phone,
    this.title,
    this.token,
    this.isDomainUser,
    this.isActiveCode,
    this.encryptedUserId,
    this.encryptedUserName,
  });

  int? id;
  String? userName;
  String? email;
  dynamic phone;
  String? title;
  String? token;
  bool? isDomainUser;
  bool? isActiveCode;
  String? encryptedUserId;
  String? encryptedUserName;

  factory LoginDetails.fromRawJson(String str) => LoginDetails.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory LoginDetails.fromJson(Map<String, dynamic> json) => LoginDetails(
    id: json["id"],
    userName: json["userName"],
    email: json["email"],
    phone: json["phone"],
    title: json["title"],
    token: json["token"],
    isDomainUser: json["isDomainUser"],
    isActiveCode: json["isActiveCode"],
    encryptedUserId: json["encryptedUserId"],
    encryptedUserName: json["encryptedUserName"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "userName": userName,
    "email": email,
    "phone": phone,
    "title": title,
    "token": token,
    "isDomainUser": isDomainUser,
    "isActiveCode": isActiveCode,
    "encryptedUserId": encryptedUserId,
    "encryptedUserName": encryptedUserName,
  };
}

class Ios {
  Ios({
    this.iconName,
    this.handleType,
    this.supportsVideo,
    this.maximumCallGroups,
    this.maximumCallsPerCallGroup,
    this.audioSessionMode,
    this.audioSessionActive,
    this.audioSessionPreferredSampleRate,
    this.audioSessionPreferredIoBufferDuration,
    this.supportsDtmf,
    this.supportsHolding,
    this.supportsGrouping,
    this.supportsUngrouping,
    this.ringtonePath,
  });

  String? iconName;
  String? handleType;
  bool? supportsVideo;
  int? maximumCallGroups;
  int? maximumCallsPerCallGroup;
  String? audioSessionMode;
  bool? audioSessionActive;
  double? audioSessionPreferredSampleRate;
  double? audioSessionPreferredIoBufferDuration;
  bool? supportsDtmf;
  bool? supportsHolding;
  bool? supportsGrouping;
  bool? supportsUngrouping;
  String? ringtonePath;

  factory Ios.fromRawJson(String str) => Ios.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Ios.fromJson(Map<String, dynamic> json) => Ios(
    iconName: json["iconName"],
    handleType: json["handleType"],
    supportsVideo: json["supportsVideo"],
    maximumCallGroups: json["maximumCallGroups"],
    maximumCallsPerCallGroup: json["maximumCallsPerCallGroup"],
    audioSessionMode: json["audioSessionMode"],
    audioSessionActive: json["audioSessionActive"],
    audioSessionPreferredSampleRate: json["audioSessionPreferredSampleRate"],
    audioSessionPreferredIoBufferDuration: json["audioSessionPreferredIOBufferDuration"]?.toDouble(),
    supportsDtmf: json["supportsDTMF"],
    supportsHolding: json["supportsHolding"],
    supportsGrouping: json["supportsGrouping"],
    supportsUngrouping: json["supportsUngrouping"],
    ringtonePath: json["ringtonePath"],
  );

  Map<String, dynamic> toJson() => {
    "iconName": iconName,
    "handleType": handleType,
    "supportsVideo": supportsVideo,
    "maximumCallGroups": maximumCallGroups,
    "maximumCallsPerCallGroup": maximumCallsPerCallGroup,
    "audioSessionMode": audioSessionMode,
    "audioSessionActive": audioSessionActive,
    "audioSessionPreferredSampleRate": audioSessionPreferredSampleRate,
    "audioSessionPreferredIOBufferDuration": audioSessionPreferredIoBufferDuration,
    "supportsDTMF": supportsDtmf,
    "supportsHolding": supportsHolding,
    "supportsGrouping": supportsGrouping,
    "supportsUngrouping": supportsUngrouping,
    "ringtonePath": ringtonePath,
  };
}
