// To parse this JSON data, do // // final voluntaryWork = voluntaryWorkFromJson(jsonString); import 'dart:convert'; VoluntaryWork voluntaryWorkFromJson(String str) => VoluntaryWork.fromJson(json.decode(str)); String voluntaryWorkToJson(VoluntaryWork data) => json.encode(data.toJson()); class VoluntaryWork { VoluntaryWork({ this.agency, this.address, this.toDate, this.position, this.fromDate, this.totalHours, }); final Agency? agency; final Address? address; final DateTime? toDate; final Position? position; final DateTime? fromDate; final int? totalHours; factory VoluntaryWork.fromJson(Map json) => VoluntaryWork( agency: json["agency"] == null ? null : Agency.fromJson(json["agency"]), address: json["address"] == null ? null : Address.fromJson(json["address"]), toDate: json["to_date"], position: json["position"] == null ? null : Position.fromJson(json["position"]), fromDate: json["from_date"] == null ? null : DateTime.parse(json["from_date"]), totalHours: json["total_hours"], ); Map toJson() => { "agency": agency?.toJson(), "address": address?.toJson(), "to_date": toDate, "position": position?.toJson(), "from_date": "${fromDate!.year.toString().padLeft(4, '0')}-${fromDate!.month.toString().padLeft(2, '0')}-${fromDate!.day.toString().padLeft(2, '0')}", "total_hours": totalHours, }; } class Address { Address({ this.id, this.addressClass, this.country, this.barangay, this.addressCategory, this.cityMunicipality, }); final int? id; final dynamic addressClass; final Country? country; final dynamic barangay; final AddressCategory? addressCategory; final CityMunicipality? cityMunicipality; factory Address.fromJson(Map json) => Address( id: json["id"], addressClass: json["class"], country: json["country"] == null ? null : Country.fromJson(json["country"]), barangay: json["barangay"], addressCategory: json["address_category"] == null ? null : AddressCategory.fromJson(json["address_category"]), cityMunicipality: json["city_municipality"] == null ? null : CityMunicipality.fromJson(json["city_municipality"]), ); Map toJson() => { "id": id, "class": addressClass, "country": country?.toJson(), "barangay": barangay, "address_category": addressCategory?.toJson(), "city_municipality": cityMunicipality?.toJson(), }; } class AddressCategory { AddressCategory({ this.id, this.name, this.type, }); final int? id; final String? name; final String? type; factory AddressCategory.fromJson(Map json) => AddressCategory( id: json["id"], name: json["name"], type: json["type"], ); Map toJson() => { "id": id, "name": name, "type": type, }; } 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 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 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 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 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 json) => Region( code: json["code"], psgcCode: json["psgc_code"], description: json["description"], ); Map toJson() => { "code": code, "psgc_code": psgcCode, "description": description, }; } class Country { Country({ this.id, this.code, this.name, }); final int? id; final String? code; final String? name; factory Country.fromJson(Map json) => Country( id: json["id"], code: json["code"], name: json["name"], ); Map toJson() => { "id": id, "code": code, "name": name, }; } class Agency { Agency({ this.id, this.name, this.category, this.privateEntity, }); final int? id; final String? name; final Category? category; final bool? privateEntity; factory Agency.fromJson(Map json) => Agency( id: json["id"], name: json["name"], category: json["category"] == null ? null : Category.fromJson(json["category"]), privateEntity: json["private_entity"], ); Map toJson() => { "id": id, "name": name, "category": category?.toJson(), "private_entity": privateEntity, }; } class Category { Category({ this.id, this.name, this.industryClass, }); final int? id; final String? name; final IndustryClass? industryClass; factory Category.fromJson(Map json) => Category( id: json["id"], name: json["name"], industryClass: json["industry_class"] == null ? null : IndustryClass.fromJson(json["industry_class"]), ); Map toJson() => { "id": id, "name": name, "industry_class": industryClass?.toJson(), }; } class IndustryClass { IndustryClass({ this.id, this.name, this.description, }); final int? id; final String? name; final dynamic description; factory IndustryClass.fromJson(Map json) => IndustryClass( id: json["id"], name: json["name"], description: json["description"], ); Map toJson() => { "id": id, "name": name, "description": description, }; } class Position { Position({ this.id, this.title, }); final int? id; final String? title; factory Position.fromJson(Map json) => Position( id: json["id"], title: json["title"], ); Map toJson() => { "id": id, "title": title, }; }