passo_mobile_app/lib/model/passo/general_description.dart

138 lines
4.9 KiB
Dart

// To parse this JSON data, do
//
// final generalDesc = generalDescFromJson(jsonString);
import 'dart:convert';
GeneralDesc generalDescFromJson(String str) =>
GeneralDesc.fromJson(json.decode(str));
String generalDescToJson(GeneralDesc data) => json.encode(data.toJson());
class GeneralDesc {
final int? id;
final int? bldgapprDetailsId;
final String? assessedById;
final String? assessedByName;
final DateTime? dateCreated;
final DateTime? dateModified;
final String? bldgKind;
final String? strucType;
final String? bldgPermit;
final DateTime? dateIssued;
final String? cct;
final DateTime? certCompletionIssued;
final DateTime? certOccupancyIssued;
final DateTime? dateCompleted;
final DateTime? dateOccupied;
final int? bldgAge;
final int? noStoreys;
final String? area1Stfloor;
final String? area2Ndfloor;
final String? area3Rdfloor;
final String? area4Thfloor;
final String? totalFloorArea;
final dynamic floorSketch;
final String? actualUse;
GeneralDesc({
this.id,
this.bldgapprDetailsId,
this.assessedById,
this.assessedByName,
this.dateCreated,
this.dateModified,
this.bldgKind,
this.strucType,
this.bldgPermit,
this.dateIssued,
this.cct,
this.certCompletionIssued,
this.certOccupancyIssued,
this.dateCompleted,
this.dateOccupied,
this.bldgAge,
this.noStoreys,
this.area1Stfloor,
this.area2Ndfloor,
this.area3Rdfloor,
this.area4Thfloor,
this.totalFloorArea,
this.floorSketch,
this.actualUse,
});
factory GeneralDesc.fromJson(Map<String, dynamic> json) => GeneralDesc(
id: json["id"],
bldgapprDetailsId: json["bldgappr_details_id"],
assessedById: json["assessed_by_id"],
assessedByName: json["assessed_by_name"],
dateCreated: json["date_created"] == null
? null
: DateTime.parse(json["date_created"]),
dateModified: json["date_modified"] == null
? null
: DateTime.parse(json["date_modified"]),
bldgKind: json["bldg_kind"],
strucType: json["struc_type"],
bldgPermit: json["bldg_permit"],
dateIssued: json["date_issued"] == null
? null
: DateTime.parse(json["date_issued"]),
cct: json["cct"],
certCompletionIssued: json["cert_completion_issued"] == null
? null
: DateTime.parse(json["cert_completion_issued"]),
certOccupancyIssued: json["cert_occupancy_issued"] == null
? null
: DateTime.parse(json["cert_occupancy_issued"]),
dateCompleted: json["date_completed"] == null
? null
: DateTime.parse(json["date_completed"]),
dateOccupied: json["date_occupied"] == null
? null
: DateTime.parse(json["date_occupied"]),
bldgAge: json["bldg_age"],
noStoreys: json["no_storeys"],
area1Stfloor: json["area_1stfloor"],
area2Ndfloor: json["area_2ndfloor"],
area3Rdfloor: json["area_3rdfloor"],
area4Thfloor: json["area_4thfloor"],
totalFloorArea: json["total_floor_area"],
floorSketch: json["floor_sketch"],
actualUse: json["actual_use"],
);
Map<String, dynamic> toJson() => {
"id": id,
"bldgappr_details_id": bldgapprDetailsId,
"assessed_by_id": assessedById,
"assessed_by_name": assessedByName,
"date_created": dateCreated?.toIso8601String(),
"date_modified": dateModified?.toIso8601String(),
"bldg_kind": bldgKind,
"struc_type": strucType,
"bldg_permit": bldgPermit,
"date_issued":
"${dateIssued!.year.toString().padLeft(4, '0')}-${dateIssued!.month.toString().padLeft(2, '0')}-${dateIssued!.day.toString().padLeft(2, '0')}",
"cct": cct,
"cert_completion_issued":
"${certCompletionIssued!.year.toString().padLeft(4, '0')}-${certCompletionIssued!.month.toString().padLeft(2, '0')}-${certCompletionIssued!.day.toString().padLeft(2, '0')}",
"cert_occupancy_issued":
"${certOccupancyIssued!.year.toString().padLeft(4, '0')}-${certOccupancyIssued!.month.toString().padLeft(2, '0')}-${certOccupancyIssued!.day.toString().padLeft(2, '0')}",
"date_completed":
"${dateCompleted!.year.toString().padLeft(4, '0')}-${dateCompleted!.month.toString().padLeft(2, '0')}-${dateCompleted!.day.toString().padLeft(2, '0')}",
"date_occupied":
"${dateOccupied!.year.toString().padLeft(4, '0')}-${dateOccupied!.month.toString().padLeft(2, '0')}-${dateOccupied!.day.toString().padLeft(2, '0')}",
"bldg_age": bldgAge,
"no_storeys": noStoreys,
"area_1stfloor": area1Stfloor,
"area_2ndfloor": area2Ndfloor,
"area_3rdfloor": area3Rdfloor,
"area_4thfloor": area4Thfloor,
"total_floor_area": totalFloorArea,
"floor_sketch": floorSketch,
"actual_use": actualUse,
};
}