class TicketDetailsModel {
  String? status;
  int? statusCode;
  String? message;
  List<Data>? data;

  TicketDetailsModel({this.status, this.statusCode, this.message, this.data});

  TicketDetailsModel.fromJson(Map<String, dynamic> json) {
    status = json['status'];
    statusCode = json['status_code'];
    message = json['message'];
    if (json['data'] != null) {
      data = <Data>[];
      json['data'].forEach((v) {
        data!.add(Data.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['status'] = status;
    data['status_code'] = statusCode;
    data['message'] = message;
    if (this.data != null) {
      data['data'] = this.data!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Data {
  int? id;
  String? uniqueTicketId;
  int? iamPrincipalXid;
  int? ticketCategoryXid;
  String? description;
  int? status;
  int? isActive;
  String? createdAt;
  TicketCategory? ticketCategory;
  List<TicketFiles>? ticketFiles;
  List<TicketResponses>? ticketResponses;

  Data(
      {this.id,
      this.uniqueTicketId,
      this.iamPrincipalXid,
      this.ticketCategoryXid,
      this.description,
      this.status,
      this.isActive,
      this.createdAt,
      this.ticketCategory,
      this.ticketFiles,
      this.ticketResponses});

  Data.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    uniqueTicketId = json['unique_ticket_id'];
    iamPrincipalXid = json['iam_principal_xid'];
    ticketCategoryXid = json['ticket_category_xid'];
    description = json['description'];
    status = json['status'];
    isActive = json['is_active'];
    createdAt = json['created_at'];
    ticketCategory = json['ticket_category'] != null
        ? TicketCategory.fromJson(json['ticket_category'])
        : null;
    if (json['ticket_files'] != null) {
      ticketFiles = <TicketFiles>[];
      json['ticket_files'].forEach((v) {
        ticketFiles!.add(TicketFiles.fromJson(v));
      });
    }
    if (json['ticket_responses'] != null) {
      ticketResponses = <TicketResponses>[];
      json['ticket_responses'].forEach((v) {
        ticketResponses!.add(TicketResponses.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['unique_ticket_id'] = uniqueTicketId;
    data['iam_principal_xid'] = iamPrincipalXid;
    data['ticket_category_xid'] = ticketCategoryXid;
    data['description'] = description;
    data['status'] = status;
    data['is_active'] = isActive;
    data['created_at'] = createdAt;
    if (ticketCategory != null) {
      data['ticket_category'] = ticketCategory!.toJson();
    }
    if (ticketFiles != null) {
      data['ticket_files'] = ticketFiles!.map((v) => v.toJson()).toList();
    }
    if (ticketResponses != null) {
      data['ticket_responses'] =
          ticketResponses!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class TicketResponses {
  int? id;
  int? iamPrincipalXid;
  int? ticketXid;
  int? isAdminResponse;
  String? response;
  String? createdAt;
  String? updatedAt;

  TicketResponses(
      {this.id,
      this.iamPrincipalXid,
      this.ticketXid,
      this.isAdminResponse,
      this.response,
      this.createdAt,
      this.updatedAt});

  TicketResponses.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    iamPrincipalXid = json['iam_principal_xid'];
    ticketXid = json['ticket_xid'];
    isAdminResponse = json['is_admin_response'];
    response = json['response'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['iam_principal_xid'] = iamPrincipalXid;
    data['ticket_xid'] = ticketXid;
    data['is_admin_response'] = isAdminResponse;
    data['response'] = response;
    data['created_at'] = createdAt;
    data['updated_at'] = updatedAt;
    return data;
  }
}

class TicketCategory {
  int? id;
  String? name;
  int? isActive;
  String? createdAt;

  TicketCategory({this.id, this.name, this.isActive, this.createdAt});

  TicketCategory.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    isActive = json['is_active'];
    createdAt = json['created_at'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['name'] = name;
    data['is_active'] = isActive;
    data['created_at'] = createdAt;
    return data;
  }
}

class TicketFiles {
  int? id;
  int? iamPrincipalXid;
  int? ticketXid;
  String? file;
  int? isActive;
  String? createdAt;

  TicketFiles(
      {this.id,
      this.iamPrincipalXid,
      this.ticketXid,
      this.file,
      this.isActive,
      this.createdAt});

  TicketFiles.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    iamPrincipalXid = json['iam_principal_xid'];
    ticketXid = json['ticket_xid'];
    file = json['file'];
    isActive = json['is_active'];
    createdAt = json['created_at'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['iam_principal_xid'] = iamPrincipalXid;
    data['ticket_xid'] = ticketXid;
    data['file'] = file;
    data['is_active'] = isActive;
    data['created_at'] = createdAt;
    return data;
  }
}
