import '../device/asset_by_id_model.dart';

class PpmSearch {
  PpmSearch({
    this.pageSize,
    this.pageNumber,
    this.id,
    this.assetId,
    this.modelId,
    this.ppmId,
    this.ppmScheduleId,
    this.classification,
    this.visitStatusId,
    this.deviceStatusId,
    this.groupLeaderReviewId,
    this.assignedEmployeeId,
    this.hasAssignedEmployee,
    this.assignedToId,
    this.expectedDateFrom,
    this.expectedDateTo,
    this.actualDateFrom,
    this.actualDateTo,
    this.siteId,
    this.jobSheetNo,
    this.typeOfServiceId,
    this.planNumber,
    this.notified,
    this.mostRecent,
    this.assetGroup,
    this.buildingId,
    this.floorId,
    this.roomId,
    this.departmentId,
    this.assetName,
  });

  PpmSearch.fromJson(dynamic json) {
    pageSize = json['pageSize'];
    pageNumber = json['pageNumber'];
    id = json['id'];
    assetId = json['assetId'];
    modelId = json['modelId'];
    ppmId = json['ppmId'];
    ppmScheduleId = json['ppmScheduleId'];
    classification = json['classification'];
    visitStatusId = json['visitStatusId'];
    deviceStatusId = json['deviceStatusId'];
    groupLeaderReviewId = json['groupLeaderReviewId'];
    assignedEmployeeId = json['assignedEmployeeId'];
    hasAssignedEmployee = json['hasAssignedEmployee'];
    assignedToId = json['assignedToId'];
    expectedDateFrom = json['expectedDateFrom'];
    expectedDateTo = json['expectedDateTo'];
    actualDateFrom = json['actualDateFrom'];
    actualDateTo = json['actualDateTo'];
    siteId = json['siteId'];
    jobSheetNo = json['jobSheetNo'];typeOfServiceId = json['typeOfServiceId'];
    planNumber = json['planNumber'];
    notified = json['notified'];
    mostRecent = json['mostRecent'];
    assetGroup = json['assetGroup'] != null ? AssetGroup.fromJson(json['assetGroup']) : null;
    buildingId = json['buildingId'];
    floorId = json['floorId'];
    roomId = json['roomId'];
    departmentId = json['departmentId'];
    assetName = json['assetName'];
  }

  num? pageSize; // Now nullable
  num? pageNumber; // Now nullable
  num? id; // Now nullable
  num? assetId; // Now nullable
  num? modelId; // Now nullable
  num? ppmId; // Now nullable
  num? ppmScheduleId; // Now nullable
  num? classification; // Now nullable
  num? visitStatusId; // Now nullable
  num? deviceStatusId; // Now nullable
  num? groupLeaderReviewId; // Now nullable
  String? assignedEmployeeId; // Now nullable
  bool? hasAssignedEmployee; // Now nullable
  num? assignedToId; // Now nullable
  String? expectedDateFrom; // Now nullable
  String? expectedDateTo; // Now nullable
  String? actualDateFrom; // Now nullable
  String? actualDateTo; // Now nullable
  num? siteId; // Now nullable
  String? jobSheetNo; // Now nullable
  num? typeOfServiceId; // Now nullable
  num? planNumber; // Now nullable
  bool? notified; // Now nullable
  bool? mostRecent; // Now nullable
  AssetGroup? assetGroup; // Now nullable
  num? buildingId; // Now nullable
  num? floorId; // Now nullable
  num? roomId; // Now nullable
  num? departmentId; // Now nullable
  String? assetName; // Now nullable

  PpmSearch copyWith({
    num? pageSize, // All parameters are now nullable
    num? pageNumber,
    num? id,
    num? assetId,
    num? modelId,
    num? ppmId,
    num? ppmScheduleId,
    num? classification,
    num? visitStatusId,
    num? deviceStatusId,
    num? groupLeaderReviewId,
    String? assignedEmployeeId,
    bool? hasAssignedEmployee,
    num? assignedToId,
    String? expectedDateFrom,
    String? expectedDateTo,
    String? actualDateFrom,
    String? actualDateTo,
    num? siteId,
    String? jobSheetNo,
    num? typeOfServiceId,
    num? planNumber,
    bool? notified,
    bool? mostRecent,
    AssetGroup? assetGroup,
    num? buildingId,
    num? floorId,
    num? roomId,
    num? departmentId,
    String? assetName,
  }) =>
      PpmSearch(
        pageSize: pageSize ?? this.pageSize,
        pageNumber: pageNumber ?? this.pageNumber,
        id: id ?? this.id,
        assetId: assetId ?? this.assetId,
        modelId: modelId ?? this.modelId,
        ppmId: ppmId ?? this.ppmId,
        ppmScheduleId: ppmScheduleId ?? this.ppmScheduleId,
        classification: classification ?? this.classification,
        visitStatusId: visitStatusId ?? this.visitStatusId,
        deviceStatusId: deviceStatusId ?? this.deviceStatusId,
        groupLeaderReviewId: groupLeaderReviewId ?? this.groupLeaderReviewId,
        assignedEmployeeId: assignedEmployeeId ?? this.assignedEmployeeId,
        hasAssignedEmployee: hasAssignedEmployee ?? this.hasAssignedEmployee,
        assignedToId: assignedToId ?? this.assignedToId,
        expectedDateFrom: expectedDateFrom ?? this.expectedDateFrom,
        expectedDateTo: expectedDateTo ?? this.expectedDateTo,
        actualDateFrom: actualDateFrom ?? this.actualDateFrom,
        actualDateTo: actualDateTo ?? this.actualDateTo,
        siteId: siteId ?? this.siteId,
        jobSheetNo: jobSheetNo ?? this.jobSheetNo,
        typeOfServiceId: typeOfServiceId ?? this.typeOfServiceId,
        planNumber: planNumber ?? this.planNumber,
        notified: notified ?? this.notified,
        mostRecent: mostRecent ?? this.mostRecent,
        assetGroup: assetGroup ?? this.assetGroup,
        buildingId: buildingId ?? this.buildingId,
        floorId: floorId ?? this.floorId,
        roomId: roomId ?? this.roomId,
        departmentId: departmentId ?? this.departmentId,
        assetName: assetName ?? this.assetName,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['pageSize'] = pageSize;
    map['pageNumber'] = pageNumber;
    map['id'] = id;
    map['assetId'] = assetId;
    map['modelId'] = modelId;
    map['ppmId'] = ppmId;
    map['ppmScheduleId'] = ppmScheduleId;
    map['classification'] = classification;
    map['visitStatusId'] = visitStatusId;
    map['deviceStatusId'] = deviceStatusId;
    map['groupLeaderReviewId'] = groupLeaderReviewId;
    map['assignedEmployeeId'] = assignedEmployeeId;
    map['hasAssignedEmployee'] = hasAssignedEmployee;
    map['assignedToId'] = assignedToId;
    map['expectedDateFrom'] = expectedDateFrom;
    map['expectedDateTo'] = expectedDateTo;
    map['actualDateFrom'] = actualDateFrom;
    map['actualDateTo'] = actualDateTo;
    map['siteId'] = siteId;
    map['jobSheetNo'] = jobSheetNo;
    map['typeOfServiceId'] = typeOfServiceId;
    map['planNumber'] = planNumber;
    map['notified'] = notified;
    map['mostRecent'] = mostRecent;
    if (assetGroup != null) {
      map['assetGroup'] = assetGroup?.toJson(); // Use '?.' to handle potential null
    }
    map['buildingId'] = buildingId;
    map['floorId'] = floorId;
    map['roomId'] = roomId;
    map['departmentId'] = departmentId;
    map['assetName'] = assetName;
    return map;
  }
}