251 lines
6.4 KiB
Dart
251 lines
6.4 KiB
Dart
|
// To parse this JSON data, do
|
||
|
//
|
||
|
// final eligibity = eligibityFromJson(jsonString);
|
||
|
|
||
|
import 'package:meta/meta.dart';
|
||
|
import 'dart:convert';
|
||
|
|
||
|
EligibityCert eligibityFromJson(String str) => EligibityCert.fromJson(json.decode(str));
|
||
|
|
||
|
String eligibityToJson(EligibityCert data) => json.encode(data.toJson());
|
||
|
|
||
|
class EligibityCert {
|
||
|
EligibityCert({
|
||
|
required this.id,
|
||
|
required this.rating,
|
||
|
required this.examDate,
|
||
|
required this.attachments,
|
||
|
required this.eligibility,
|
||
|
required this.examAddress,
|
||
|
required this.validityDate,
|
||
|
required this.licenseNumber,
|
||
|
});
|
||
|
|
||
|
final int? id;
|
||
|
final double? rating;
|
||
|
final DateTime? examDate;
|
||
|
final dynamic attachments;
|
||
|
final Eligibility? eligibility;
|
||
|
final ExamAddress? examAddress;
|
||
|
final DateTime? validityDate;
|
||
|
final DateTime? licenseNumber;
|
||
|
|
||
|
factory EligibityCert.fromJson(Map<String, dynamic> json) => EligibityCert(
|
||
|
id: json["id"],
|
||
|
rating: json["rating"]?.toDouble(),
|
||
|
examDate: DateTime.parse(json["exam_date"]),
|
||
|
attachments: null,
|
||
|
eligibility: Eligibility.fromJson(json["eligibility"]),
|
||
|
examAddress: ExamAddress.fromJson(json["exam_address"]),
|
||
|
validityDate: json["validity_date"],
|
||
|
licenseNumber: json["license_number"],
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"id": id,
|
||
|
"rating": rating,
|
||
|
"exam_date": "${examDate!.year.toString().padLeft(4, '0')}-${examDate!.month.toString().padLeft(2, '0')}-${examDate!.day.toString().padLeft(2, '0')}",
|
||
|
"attachments": attachments,
|
||
|
"eligibility": eligibility!.toJson(),
|
||
|
"exam_address": examAddress!.toJson(),
|
||
|
"validity_date": validityDate,
|
||
|
"license_number": licenseNumber,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class Eligibility {
|
||
|
Eligibility({
|
||
|
required this.id,
|
||
|
required this.type,
|
||
|
required this.title,
|
||
|
});
|
||
|
|
||
|
final int? id;
|
||
|
final String? type;
|
||
|
final String? title;
|
||
|
|
||
|
factory Eligibility.fromJson(Map<String, dynamic> json) => Eligibility(
|
||
|
id: json["id"],
|
||
|
type: json["type"],
|
||
|
title: json["title"],
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"id": id,
|
||
|
"type": type,
|
||
|
"title": title,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class ExamAddress {
|
||
|
ExamAddress({
|
||
|
required this.id,
|
||
|
required this.examAddressClass,
|
||
|
required this.country,
|
||
|
required this.barangay,
|
||
|
required this.addressCategory,
|
||
|
required this.cityMunicipality,
|
||
|
});
|
||
|
|
||
|
final int? id;
|
||
|
final dynamic examAddressClass;
|
||
|
final Country? country;
|
||
|
final dynamic barangay;
|
||
|
final AddressCategory? addressCategory;
|
||
|
final CityMunicipality? cityMunicipality;
|
||
|
|
||
|
factory ExamAddress.fromJson(Map<String, dynamic> json) => ExamAddress(
|
||
|
id: json["id"],
|
||
|
examAddressClass: json["class"],
|
||
|
country: Country.fromJson(json["country"]),
|
||
|
barangay: json["barangay"],
|
||
|
addressCategory: AddressCategory.fromJson(json["address_category"]),
|
||
|
cityMunicipality: CityMunicipality.fromJson(json["city_municipality"]),
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"id": id,
|
||
|
"class": examAddressClass,
|
||
|
"country": country!.toJson(),
|
||
|
"barangay": barangay,
|
||
|
"address_category": addressCategory!.toJson(),
|
||
|
"city_municipality": cityMunicipality!.toJson(),
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class AddressCategory {
|
||
|
AddressCategory({
|
||
|
required this.id,
|
||
|
required this.name,
|
||
|
required this.type,
|
||
|
});
|
||
|
|
||
|
final int? id;
|
||
|
final String? name;
|
||
|
final String? type;
|
||
|
|
||
|
factory AddressCategory.fromJson(Map<String, dynamic> json) => AddressCategory(
|
||
|
id: json["id"],
|
||
|
name: json["name"],
|
||
|
type: json["type"],
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"id": id,
|
||
|
"name": name,
|
||
|
"type": type,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class CityMunicipality {
|
||
|
CityMunicipality({
|
||
|
required this.code,
|
||
|
required this.zipcode,
|
||
|
required this.province,
|
||
|
required this.psgcCode,
|
||
|
required 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: 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({
|
||
|
required this.code,
|
||
|
required this.region,
|
||
|
required this.psgcCode,
|
||
|
required this.shortname,
|
||
|
required 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: 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({
|
||
|
required this.code,
|
||
|
required this.psgcCode,
|
||
|
required 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 Country {
|
||
|
Country({
|
||
|
required this.id,
|
||
|
required this.code,
|
||
|
required 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,
|
||
|
};
|
||
|
}
|