

class MainAdress {
    MainAdress({
        this.id,
        this.address,
        this.details,
        this.subdivision,
    });

    final int? id;
    final AddressClass? address;
    final String? details;
    final Subdivision? subdivision;

    factory MainAdress.fromJson(Map<String, dynamic> json) => MainAdress(
        id: json["id"],
        address: json["address"] == null ? null : AddressClass.fromJson(json["address"]),
        details: json["details"],
        subdivision: json["subdivision"] == null ? null : Subdivision.fromJson(json["subdivision"]),
    );

    Map<String, dynamic> toJson() => {
        "id": id,
        "address": address?.toJson(),
        "details": details,
        "subdivision": subdivision?.toJson(),
    };
}

class AddressClass {
    AddressClass({
        this.id,
        this.country,
        this.barangay,
        this.category,
        this.areaClass,
        this.cityMunicipality,
    });

    final int? id;
    final Country? country;
    final Barangay? barangay;
    final Category? category;
    final String? areaClass;
    final CityMunicipality? cityMunicipality;

    factory AddressClass.fromJson(Map<String, dynamic> json) => AddressClass(
        id: json["id"],
        country: json["country"] == null ? null : Country.fromJson(json["country"]),
        barangay: json["barangay"] == null ? null : Barangay.fromJson(json["barangay"]),
        category: json["category"] == null ? null : Category.fromJson(json["category"]),
        areaClass: json["area_class"],
        cityMunicipality: json["city_municipality"] == null ? null : CityMunicipality.fromJson(json["city_municipality"]),
    );

    Map<String, dynamic> toJson() => {
        "id": id,
        "country": country?.toJson(),
        "barangay": barangay?.toJson(),
        "category": category?.toJson(),
        "area_class": areaClass,
        "city_municipality": cityMunicipality?.toJson(),
    };
}

class Barangay {
    Barangay({
        this.code,
        this.description,
        this.cityMunicipality,
    });

    final String? code;
    final String? description;
    final CityMunicipality? cityMunicipality;

    factory Barangay.fromJson(Map<String, dynamic> json) => Barangay(
        code: json["code"],
        description: json["description"],
        cityMunicipality: json["city_municipality"] == null ? null : CityMunicipality.fromJson(json["city_municipality"]),
    );

    Map<String, dynamic> toJson() => {
        "code": code,
        "description": description,
        "city_municipality": cityMunicipality?.toJson(),
    };
}

class CityMunicipality {
    CityMunicipality({
        this.code,
        this.zipcode,
        this.province,
        this.psgcCode,
        this.description,
    });

    final String? code;
    final String? zipcode;
    final Province? province;
    final String? psgcCode;
    final String? description;

    factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
        code: json["code"],
        zipcode: json["zipcode"],
        province: json["province"] == null ? null : Province.fromJson(json["province"]),
        psgcCode: json["psgc_code"],
        description: json["description"],
    );

    Map<String, dynamic> toJson() => {
        "code": code,
        "zipcode": zipcode,
        "province": province?.toJson(),
        "psgc_code": psgcCode,
        "description": description,
    };
}

class Province {
    Province({
        this.code,
        this.region,
        this.psgcCode,
        this.shortname,
        this.description,
    });

    final String? code;
    final Region? region;
    final String? psgcCode;
    final String? shortname;
    final String? description;

    factory Province.fromJson(Map<String, dynamic> json) => Province(
        code: json["code"],
        region: json["region"] == null ? null : Region.fromJson(json["region"]),
        psgcCode: json["psgc_code"],
        shortname: json["shortname"],
        description: json["description"],
    );

    Map<String, dynamic> toJson() => {
        "code": code,
        "region": region?.toJson(),
        "psgc_code": psgcCode,
        "shortname": shortname,
        "description": description,
    };
}

class Region {
    Region({
        this.code,
        this.psgcCode,
        this.description,
    });

    final int? code;
    final String? psgcCode;
    final String? description;

    factory Region.fromJson(Map<String, dynamic> json) => Region(
        code: json["code"],
        psgcCode: json["psgc_code"],
        description: json["description"],
    );

    Map<String, dynamic> toJson() => {
        "code": code,
        "psgc_code": psgcCode,
        "description": description,
    };
}

class Category {
    Category({
        this.id,
        this.name,
        this.type,
    });

    final int? id;
    final String? name;
    final String? type;

    factory Category.fromJson(Map<String, dynamic> json) => Category(
        id: json["id"],
        name: json["name"],
        type: json["type"],
    );

    Map<String, dynamic> toJson() => {
        "id": id,
        "name": name,
        "type": type,
    };
}

class Country {
    Country({
        this.id,
        this.code,
        this.name,
    });

    final int? id;
    final String? code;
    final String? name;

    factory Country.fromJson(Map<String, dynamic> json) => Country(
        id: json["id"],
        code: json["code"],
        name: json["name"],
    );

    Map<String, dynamic> toJson() => {
        "id": id,
        "code": code,
        "name": name,
    };
}

class Subdivision {
    Subdivision({
        this.id,
        this.lotNo,
        this.blockNo,
    });

    final int? id;
    final int? lotNo;
    final int? blockNo;

    factory Subdivision.fromJson(Map<String, dynamic> json) => Subdivision(
        id: json["id"],
        lotNo: json["lot_no"],
        blockNo: json["block_no"],
    );

    Map<String, dynamic> toJson() => {
        "id": id,
        "lot_no": lotNo,
        "block_no": blockNo,
    };
}
