class TaskPlanningDetailsModel { final List buildings; final String id; final String name; final String projectAddress; final String contactPerson; final DateTime startDate; final DateTime endDate; final String projectStatusId; TaskPlanningDetailsModel({ required this.buildings, required this.id, required this.name, required this.projectAddress, required this.contactPerson, required this.startDate, required this.endDate, required this.projectStatusId, }); factory TaskPlanningDetailsModel.fromJson(Map json) { return TaskPlanningDetailsModel( buildings: (json['buildings'] as List?) ?.map((b) => Building.fromJson(b)) .toList() ?? [], id: json['id'], name: json['name'], projectAddress: json['projectAddress'], contactPerson: json['contactPerson'], startDate: DateTime.parse(json['startDate']), endDate: DateTime.parse(json['endDate']), projectStatusId: json['projectStatusId'], ); } } class Building { final String id; final String name; final String description; final List floors; Building({ required this.id, required this.name, required this.description, required this.floors, }); factory Building.fromJson(Map json) { return Building( id: json['id'], name: json['name'], description: json['description'], floors: (json['floors'] as List).map((f) => Floor.fromJson(f)).toList(), ); } } class Floor { final String id; final String floorName; final List workAreas; Floor({ required this.id, required this.floorName, required this.workAreas, }); factory Floor.fromJson(Map json) { return Floor( id: json['id'], floorName: json['floorName'], workAreas: (json['workAreas'] as List).map((w) => WorkArea.fromJson(w)).toList(), ); } } class WorkArea { final String id; final String areaName; final List workItems; WorkArea({ required this.id, required this.areaName, required this.workItems, }); factory WorkArea.fromJson(Map json) { return WorkArea( id: json['id'], areaName: json['areaName'], workItems: (json['workItems'] as List) .map((w) => WorkItemWrapper.fromJson(w)) .toList(), ); } } class WorkItemWrapper { final String workItemId; final WorkItem workItem; WorkItemWrapper({ required this.workItemId, required this.workItem, }); factory WorkItemWrapper.fromJson(Map json) { return WorkItemWrapper( workItemId: json['workItemId'], workItem: WorkItem.fromJson(json['workItem']), ); } } class WorkItem { final String? id; final String? activityId; final String? workCategoryId; final String? workAreaId; final WorkAreaBasic? workArea; final ActivityMaster? activityMaster; final WorkCategoryMaster? workCategoryMaster; final int? plannedWork; final int? completedWork; final DateTime? taskDate; final String? tenantId; final Tenant? tenant; WorkItem({ this.id, this.activityId, this.workCategoryId, this.workAreaId, this.workArea, this.activityMaster, this.workCategoryMaster, this.plannedWork, this.completedWork, this.taskDate, this.tenantId, this.tenant, }); factory WorkItem.fromJson(Map json) { return WorkItem( id: json['id'] as String?, activityId: json['activityId'] as String?, workCategoryId: json['workCategoryId'] as String?, workAreaId: json['workAreaId'] as String?, workArea: json['workArea'] != null ? WorkAreaBasic.fromJson(json['workArea'] as Map) : null, activityMaster: json['activityMaster'] != null ? ActivityMaster.fromJson( json['activityMaster'] as Map) : null, workCategoryMaster: json['workCategoryMaster'] != null ? WorkCategoryMaster.fromJson( json['workCategoryMaster'] as Map) : null, plannedWork: json['plannedWork'] as int?, completedWork: json['completedWork'] as int?, taskDate: json['taskDate'] != null ? DateTime.tryParse(json['taskDate']) : null, tenantId: json['tenantId'] as String?, tenant: json['tenant'] != null ? Tenant.fromJson(json['tenant'] as Map) : null, ); } } class WorkAreaBasic { final String? id; final String? name; WorkAreaBasic({this.id, this.name}); factory WorkAreaBasic.fromJson(Map json) { return WorkAreaBasic( id: json['id'] as String?, name: json['name'] as String?, ); } } class ActivityMaster { final String? id; final String? name; ActivityMaster({this.id, this.name}); factory ActivityMaster.fromJson(Map json) { return ActivityMaster( id: json['id'] as String?, name: json['activityName'] as String?, ); } } class WorkCategoryMaster { final String? id; final String? name; WorkCategoryMaster({this.id, this.name}); factory WorkCategoryMaster.fromJson(Map json) { return WorkCategoryMaster( id: json['id'] as String?, name: json['name'] as String?, ); } } class Tenant { final String? id; final String? name; Tenant({this.id, this.name}); factory Tenant.fromJson(Map json) { return Tenant( id: json['id'] as String?, name: json['name'] as String?, ); } }