class SingleTicket {
  int? status;
  Data? data;

  SingleTicket({this.status, this.data});

  SingleTicket.fromJson(Map<String, dynamic> json) {
    status = json['status'];
    data = json['data'] != null ? Data.fromJson(json['data']) : null;
  }

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

class Data {
  String? subject;
  List<Messages>? messages;

  Data({this.subject, this.messages});

  Data.fromJson(Map<String, dynamic> json) {
    subject = json['subject'];
    if (json['messages'] != null) {
      messages = <Messages>[];
      json['messages'].forEach((v) {
        messages!.add(Messages.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['subject'] = subject;
    if (messages != null) {
      data['messages'] = messages!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Messages {
  int? id;
  int? threadId;
  String? message;
  int? userId;
  int? managerId;
  String? createdAt;
  String? deletedAt;
  String? updatedAt;
  UserDetails? userDetails;
  ManagerDetails? managerDetails;

  Messages({
    this.id,
    this.threadId,
    this.message,
    this.userId,
    this.managerId,
    this.createdAt,
    this.deletedAt,
    this.updatedAt,
    this.userDetails,
    this.managerDetails,
  });

  Messages.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    threadId = json['thread_id'];
    message = json['message'];
    userId = json['user_id'];
    managerId = json['manager_id'];
    createdAt = json['created_at'];
    deletedAt = json['deleted_at'];
    updatedAt = json['updated_at'];
    userDetails = json['user_details'] != null
        ? UserDetails.fromJson(json['user_details'])
        : null;
    managerDetails = json['manager_details'] != null
        ? ManagerDetails.fromJson(json['manager_details'])
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['thread_id'] = threadId;
    data['message'] = message;
    data['user_id'] = userId;
    data['manager_id'] = managerId;
    data['created_at'] = createdAt;
    data['deleted_at'] = deletedAt;
    data['updated_at'] = updatedAt;
    if (userDetails != null) {
      data['user_details'] = userDetails!.toJson();
    }
    if (managerDetails != null) {
      data['manager_details'] = managerDetails!.toJson();
    }
    return data;
  }
}

class UserDetails {
  int? id;
  String? username;
  String? firstname;
  String? lastname;

  UserDetails({this.id, this.username, this.firstname, this.lastname});

  UserDetails.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    username = json['username'];
    firstname = json['firstname'];
    lastname = json['lastname'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['username'] = username;
    data['firstname'] = firstname;
    data['lastname'] = lastname;
    return data;
  }
}

class ManagerDetails {
  int? id;
  String? username;
  String? firstname;
  String? lastname;

  ManagerDetails({this.id, this.username, this.firstname, this.lastname});

  ManagerDetails.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    username = json['username'];
    firstname = json['firstname'];
    lastname = json['lastname'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['username'] = username;
    data['firstname'] = firstname;
    data['lastname'] = lastname;
    return data;
  }
}
