// To parse this JSON data, do // // final workHistory = workHistoryFromJson(jsonString); import 'dart:convert'; WorkHistory workHistoryFromJson(String str) => WorkHistory.fromJson(json.decode(str)); String workHistoryToJson(WorkHistory data) => json.encode(data.toJson()); class WorkHistory { WorkHistory({ this.id, this.agency, this.sgStep, this.toDate, this.position, this.fromDate, // this.attachments, this.salaryGrade, this.monthlySalary, this.appointmentStatus, }); final int? id; final Agency? agency; final int? sgStep; final DateTime? toDate; final Position? position; final DateTime? fromDate; // final dynamic attachments; final int? salaryGrade; final int? monthlySalary; final String? appointmentStatus; factory WorkHistory.fromJson(Map json) => WorkHistory( id: json["id"], agency: json["agency"] == null ? null : Agency.fromJson(json["agency"]), sgStep: json["sg_step"], toDate: json["to_date"] == null ? null : DateTime.parse(json["to_date"]), position: json["position"] == null ? null : Position.fromJson(json["position"]), fromDate: json["from_date"] == null ? null : DateTime.parse(json["from_date"]), // attachments: json["attachments"], salaryGrade: json["salary_grade"], monthlySalary: json["monthly_salary"], appointmentStatus: json["appointment_status"], ); Map toJson() => { "id": id, "agency": agency?.toJson(), "sg_step": sgStep, "to_date": "${toDate!.year.toString().padLeft(4, '0')}-${toDate!.month.toString().padLeft(2, '0')}-${toDate!.day.toString().padLeft(2, '0')}", "position": position?.toJson(), "from_date": "${fromDate!.year.toString().padLeft(4, '0')}-${fromDate!.month.toString().padLeft(2, '0')}-${fromDate!.day.toString().padLeft(2, '0')}", // "attachments": attachments, "salary_grade": salaryGrade, "monthly_salary": monthlySalary, "appointment_status": appointmentStatus, }; } 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, }; }