// Root Response Model class ProjectsResponse { final bool? success; final String? message; final ProjectsPageData? data; final dynamic errors; final int? statusCode; final String? timestamp; ProjectsResponse({ this.success, this.message, this.data, this.errors, this.statusCode, this.timestamp, }); factory ProjectsResponse.fromJson(Map json) { return ProjectsResponse( success: json['success'], message: json['message'], data: json['data'] != null ? ProjectsPageData.fromJson(json['data']) : null, errors: json['errors'], statusCode: json['statusCode'], timestamp: json['timestamp'], ); } Map toJson() { return { 'success': success, 'message': message, 'data': data?.toJson(), 'errors': errors, 'statusCode': statusCode, 'timestamp': timestamp, }; } } // Pagination + Data List class ProjectsPageData { final int? currentPage; final int? totalPages; final int? totalEntites; final List? data; ProjectsPageData({ this.currentPage, this.totalPages, this.totalEntites, this.data, }); factory ProjectsPageData.fromJson(Map json) { return ProjectsPageData( currentPage: json['currentPage'], totalPages: json['totalPages'], totalEntites: json['totalEntites'], data: (json['data'] as List?) ?.map((e) => ProjectData.fromJson(e)) .toList(), ); } Map toJson() { return { 'currentPage': currentPage, 'totalPages': totalPages, 'totalEntites': totalEntites, 'data': data?.map((e) => e.toJson()).toList(), }; } } // Individual Project Model class ProjectData { final String? id; final String? name; final String? shortName; final String? projectAddress; final String? contactPerson; final String? startDate; final String? endDate; final String? projectStatusId; final int? teamSize; final double? completedWork; final double? plannedWork; ProjectData({ this.id, this.name, this.shortName, this.projectAddress, this.contactPerson, this.startDate, this.endDate, this.projectStatusId, this.teamSize, this.completedWork, this.plannedWork, }); factory ProjectData.fromJson(Map json) { return ProjectData( id: json['id'], name: json['name'], shortName: json['shortName'], projectAddress: json['projectAddress'], contactPerson: json['contactPerson'], startDate: json['startDate'], endDate: json['endDate'], projectStatusId: json['projectStatusId'], teamSize: json['teamSize'], completedWork: (json['completedWork'] as num?)?.toDouble(), plannedWork: (json['plannedWork'] as num?)?.toDouble(), ); } Map toJson() { return { 'id': id, 'name': name, 'shortName': shortName, 'projectAddress': projectAddress, 'contactPerson': contactPerson, 'startDate': startDate, 'endDate': endDate, 'projectStatusId': projectStatusId, 'teamSize': teamSize, 'completedWork': completedWork, 'plannedWork': plannedWork, }; } }