class CityModel {
  final bool? status;
  final List<DistrictData>? districtsData;

  CityModel({this.status, this.districtsData});

  factory CityModel.fromJson(Map<String, dynamic> json) {
    return CityModel(
      status: json['status'],
      districtsData: json['districts_data'] != null
          ? List<DistrictData>.from(
              json['districts_data'].map((x) => DistrictData.fromJson(x)),
            )
          : [],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'status': status,
      'districts_data': districtsData?.map((x) => x.toJson()).toList(),
    };
  }
}

class DistrictData {
  final int? id;
  final String? districtName;
  final int? active;
  final int? stateId;
  final dynamic createdBy;
  final dynamic updatedBy;
  final String? createdAt;
  final String? updatedAt;

  DistrictData({
    this.id,
    this.districtName,
    this.active,
    this.stateId,
    this.createdBy,
    this.updatedBy,
    this.createdAt,
    this.updatedAt,
  });

  factory DistrictData.fromJson(Map<String, dynamic> json) {
    return DistrictData(
      id: json['id'],
      districtName: json['district_name'],
      active: json['active'],
      stateId: json['state_id'],
      createdBy: json['created_by'],
      updatedBy: json['updated_by'],
      createdAt: json['created_at'],
      updatedAt: json['updated_at'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'district_name': districtName,
      'active': active,
      'state_id': stateId,
      'created_by': createdBy,
      'updated_by': updatedBy,
      'created_at': createdAt,
      'updated_at': updatedAt,
    };
  }
}
