class ProjectModel {
  final int id; // Unique identifier for the project
  final String name; // Name of the project
  final String projectAddress; // Address of the project
  final String contactPerson; // Contact person for the project
  final DateTime startDate; // Start date of the project
  final DateTime endDate; // End date of the project
  final int teamSize; // Number of people in the team
  final int completedWork; // Completed work percentage
  final int plannedWork; // Planned work for the project
  final int projectStatusId; // Status ID for the project
  final int tenantId; // Tenant ID associated with the project

  // Constructor
  ProjectModel({
    required this.id,
    required this.name,
    required this.projectAddress,
    required this.contactPerson,
    required this.startDate,
    required this.endDate,
    required this.teamSize,
    required this.completedWork,
    required this.plannedWork,
    required this.projectStatusId,
    required this.tenantId,
  });

  // Factory method to create an instance of ProjectModel from a JSON object
  factory ProjectModel.fromJson(Map<String, dynamic> json) {
    return ProjectModel(
      id: json['id'],
      name: json['name'],
      projectAddress: json['projectAddress'],
      contactPerson: json['contactPerson'],
      startDate: DateTime.parse(json['startDate']),
      endDate: DateTime.parse(json['endDate']),
      teamSize: json['teamSize'],
      completedWork: json['completedWork'],
      plannedWork: json['plannedWork'],
      projectStatusId: json['projectStatusId'],
      tenantId: json['tenantId'],
    );
  }

  // Method to convert the ProjectModel instance back to a JSON object
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'name': name,
      'projectAddress': projectAddress,
      'contactPerson': contactPerson,
      'startDate': startDate.toIso8601String(),
      'endDate': endDate.toIso8601String(),
      'teamSize': teamSize,
      'completedWork': completedWork,
      'plannedWork': plannedWork,
      'projectStatusId': projectStatusId,
      'tenantId': tenantId,
    };
  }
}
