// To parse this JSON data, do
//
//     final callDataModel = callDataModelFromJson(jsonString);

import 'dart:convert';

class CallDataModel {
  CallDataModel({
    this.callerId,
    this.callerDetails,
    this.receiverId,
    this.receiverDetails,
    this.title,
    this.calltype,
  });

  String? callerId;
  CallerDetails? callerDetails;
  String? receiverId;
  ReceiverDetails? receiverDetails;
  dynamic title;
  String? calltype;

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

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

  factory CallDataModel.fromJson(Map<String, dynamic> json) => CallDataModel(
    callerId: json["callerID"],
    callerDetails: json["callerDetails"] == null ? null : CallerDetails.fromJson(json["callerDetails"]),
    receiverId: json["receiverID"],
    receiverDetails: json["receiverDetails"] == null ? null : ReceiverDetails.fromJson(json["receiverDetails"]),
    title: json["title"],
    calltype: json["calltype"],
  );

  Map<String, dynamic> toJson() => {
    "callerID": callerId,
    "callerDetails": callerDetails?.toJson(),
    "receiverID": receiverId,
    "receiverDetails": receiverDetails?.toJson(),
    "title": title,
    "calltype": calltype,
  };
}

class CallerDetails {
  CallerDetails({
    this.response,
    this.errorResponses,
  });

  Response? response;
  dynamic errorResponses;

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

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

  factory CallerDetails.fromJson(Map<String, dynamic> json) => CallerDetails(
    response: json["response"] == null ? null : Response.fromJson(json["response"]),
    errorResponses: json["errorResponses"],
  );

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

class Response {
  Response({
    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 Response.fromRawJson(String str) => Response.fromJson(json.decode(str));

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

  factory Response.fromJson(Map<String, dynamic> json) => Response(
    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 ReceiverDetails {
  ReceiverDetails({
    this.id,
    this.userName,
    this.email,
    this.phone,
    this.title,
    this.userStatus,
    this.image,
    this.unreadMessageCount,
    this.userAction,
    this.isPin,
    this.isFav,
    this.isAdmin,
    this.rKey,
    this.totalCount,
  });

  int? id;
  String? userName;
  String? email;
  dynamic phone;
  dynamic title;
  int? userStatus;
  String? image;
  int? unreadMessageCount;
  dynamic userAction;
  bool? isPin;
  bool? isFav;
  bool? isAdmin;
  String? rKey;
  int? totalCount;

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

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

  factory ReceiverDetails.fromJson(Map<String, dynamic> json) => ReceiverDetails(
    id: json["id"],
    userName: json["userName"],
    email: json["email"],
    phone: json["phone"],
    title: json["title"],
    userStatus: json["userStatus"],
    image: json["image"],
    unreadMessageCount: json["unreadMessageCount"],
    userAction: json["userAction"],
    isPin: json["isPin"],
    isFav: json["isFav"],
    isAdmin: json["isAdmin"],
    rKey: json["rKey"],
    totalCount: json["totalCount"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "userName": userName,
    "email": email,
    "phone": phone,
    "title": title,
    "userStatus": userStatus,
    "image": image,
    "unreadMessageCount": unreadMessageCount,
    "userAction": userAction,
    "isPin": isPin,
    "isFav": isFav,
    "isAdmin": isAdmin,
    "rKey": rKey,
    "totalCount": totalCount,
  };
}
