2023-02-07 02:37:15 +00:00
|
|
|
// To parse this JSON data, do
|
|
|
|
//
|
|
|
|
// final voluntaryWork = voluntaryWorkFromJson(jsonString);
|
|
|
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
2023-02-20 07:48:24 +00:00
|
|
|
import '../location/address_category.dart';
|
|
|
|
import '../location/city.dart';
|
|
|
|
import '../location/country.dart';
|
|
|
|
import '../utils/agency.dart';
|
|
|
|
import '../utils/position.dart';
|
|
|
|
|
2023-02-07 02:37:15 +00:00
|
|
|
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;
|
2023-05-02 00:26:42 +00:00
|
|
|
final double? totalHours;
|
2023-02-07 02:37:15 +00:00
|
|
|
|
|
|
|
factory VoluntaryWork.fromJson(Map<String, dynamic> json) => VoluntaryWork(
|
|
|
|
agency: json["agency"] == null ? null : Agency.fromJson(json["agency"]),
|
|
|
|
address: json["address"] == null ? null : Address.fromJson(json["address"]),
|
2023-05-02 00:26:42 +00:00
|
|
|
toDate: json["to_date"] == null? null : DateTime.parse(json['to_date']),
|
2023-02-07 02:37:15 +00:00
|
|
|
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<String, dynamic> 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<String, dynamic> 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<String, dynamic> toJson() => {
|
|
|
|
"id": id,
|
|
|
|
"class": addressClass,
|
|
|
|
"country": country?.toJson(),
|
|
|
|
"barangay": barangay,
|
|
|
|
"address_category": addressCategory?.toJson(),
|
|
|
|
"city_municipality": cityMunicipality?.toJson(),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|