2023-02-03 03:34:09 +00:00
|
|
|
// To parse this JSON data, do
|
|
|
|
//
|
|
|
|
// final eligibity = eligibityFromJson(jsonString);
|
|
|
|
|
|
|
|
import 'package:meta/meta.dart';
|
|
|
|
import 'dart:convert';
|
|
|
|
|
2023-02-20 07:48:24 +00:00
|
|
|
import 'package:unit2/model/location/region.dart';
|
|
|
|
|
|
|
|
import '../location/address_category.dart';
|
|
|
|
import '../location/city.dart';
|
|
|
|
import '../location/country.dart';
|
|
|
|
import '../utils/eligibility.dart';
|
|
|
|
|
2023-02-03 03:34:09 +00:00
|
|
|
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,
|
2023-02-20 07:48:24 +00:00
|
|
|
required this.overseas,
|
|
|
|
});
|
|
|
|
bool? overseas;
|
2023-02-03 03:34:09 +00:00
|
|
|
final int? id;
|
|
|
|
final double? rating;
|
|
|
|
final DateTime? examDate;
|
|
|
|
final dynamic attachments;
|
|
|
|
final Eligibility? eligibility;
|
|
|
|
final ExamAddress? examAddress;
|
|
|
|
final DateTime? validityDate;
|
2023-02-09 08:48:19 +00:00
|
|
|
final String? licenseNumber;
|
2023-02-03 03:34:09 +00:00
|
|
|
|
|
|
|
factory EligibityCert.fromJson(Map<String, dynamic> json) => EligibityCert(
|
|
|
|
id: json["id"],
|
|
|
|
rating: json["rating"]?.toDouble(),
|
2023-02-10 07:39:00 +00:00
|
|
|
examDate: json['exam_date'] == null? null: DateTime.parse(json["exam_date"]),
|
2023-02-03 03:34:09 +00:00
|
|
|
attachments: null,
|
2023-02-10 07:39:00 +00:00
|
|
|
eligibility: json['eligibility'] == null?null: Eligibility.fromJson(json["eligibility"]),
|
2023-02-16 07:10:54 +00:00
|
|
|
examAddress: json['exam_address'] == null? null: ExamAddress.fromJson(json["exam_address"]),
|
2023-02-03 03:34:09 +00:00
|
|
|
validityDate: json["validity_date"],
|
|
|
|
licenseNumber: json["license_number"],
|
2023-02-20 07:48:24 +00:00
|
|
|
overseas: null,
|
2023-02-03 03:34:09 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
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 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"],
|
2023-02-10 07:39:00 +00:00
|
|
|
country:json["country"] == null? null: Country.fromJson(json["country"]),
|
2023-02-03 03:34:09 +00:00
|
|
|
barangay: json["barangay"],
|
2023-02-10 07:39:00 +00:00
|
|
|
addressCategory: json["address_category"] == null?null: AddressCategory.fromJson(json["address_category"]),
|
|
|
|
cityMunicipality: json["city_municipality"]==null? null: CityMunicipality.fromJson(json["city_municipality"]),
|
2023-02-03 03:34:09 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"id": id,
|
|
|
|
"class": examAddressClass,
|
|
|
|
"country": country!.toJson(),
|
|
|
|
"barangay": barangay,
|
|
|
|
"address_category": addressCategory!.toJson(),
|
|
|
|
"city_municipality": cityMunicipality!.toJson(),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|