import 'package:test_sa/models/new_models/site.dart';

class SessionModel {
  int? id;
  String? createdDate;
  String? sessionName;
  int? sessionTypeId;
  int? sessionTypeValue;
  String? sessionTypeName;
  int? statusId;
  String? statusName;
  String? startDate;
  String? endDate;
  List<Site> assetInventorySites = [];
  List<AssetInventoryAssignedEmployee> assetInventoryAssignedEmployee = [];

  SessionModel({
    this.id,
    this.sessionName,
    this.createdDate,
    this.sessionTypeId,
    this.sessionTypeValue,
    this.sessionTypeName,
    this.statusId,
    this.statusName,
    this.startDate,
    this.endDate,
    List<Site>? assetInventorySites,
    List<AssetInventoryAssignedEmployee>? assetInventoryAssignedEmployee,
  }) {
    this.assetInventorySites = assetInventorySites ?? [];
    this.assetInventoryAssignedEmployee = assetInventoryAssignedEmployee ?? [];
  }

  SessionModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    sessionName = json['sessionName'];
    sessionTypeId = json['sessionTypeId'];
    sessionTypeValue = json['sessionTypeValue'];
    sessionTypeName = json['sessionTypeName'];
    statusId = json['statusId'];
    createdDate = json['createdDate'];
    statusName = json['statusName'];
    startDate = json['startDate'];
    endDate = json['endDate'];

    if (json['assetInventorySites'] != null) {
      assetInventorySites = (json['assetInventorySites'] as List).map((e) => Site.fromJson(e)).toList();
    }

    if (json['assetInventoryAssignedEmployee'] != null) {
      assetInventoryAssignedEmployee = (json['assetInventoryAssignedEmployee'] as List).map((e) => AssetInventoryAssignedEmployee.fromJson(e)).toList();
    }
  }

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = id;
    map['sessionName'] = sessionName;
    map['sessionTypeId'] = sessionTypeId;
    map['sessionTypeValue'] = sessionTypeValue;
    map['sessionTypeName'] = sessionTypeName;
    map['statusId'] = statusId;
    map['statusName'] = statusName;
    map['createdDate'] = createdDate;
    map['startDate'] = startDate;
    map['endDate'] = endDate;
    map['assetInventorySites'] = assetInventorySites.map((e) => e.toJson()).toList();
    map['assetInventoryAssignedEmployee'] = assetInventoryAssignedEmployee.map((e) => e.toJson()).toList();
    return map;
  }
}

// class AssetInventorySite {
//   int? siteId;
//   String? siteName;
//   List<AssetInventoryBuilding> assetInventoryBuildings = [];
//
//   AssetInventorySite({
//     this.siteId,
//     this.siteName,
//     List<AssetInventoryBuilding>? assetInventoryBuildings,
//   }) {
//     this.assetInventoryBuildings = assetInventoryBuildings ?? [];
//   }
//
//   AssetInventorySite.fromJson(Map<String, dynamic> json) {
//     siteId = json['siteId'];
//     siteName = json['siteName'];
//
//     if (json['assetInventoryBuildings'] != null) {
//       assetInventoryBuildings = (json['assetInventoryBuildings'] as List).map((e) => AssetInventoryBuilding.fromJson(e)).toList();
//     }
//   }
//
//   Map<String, dynamic> toJson() {
//     final map = <String, dynamic>{};
//     map['siteId'] = siteId;
//     map['siteName'] = siteName;
//     map['assetInventoryBuildings'] = assetInventoryBuildings.map((e) => e.toJson()).toList();
//     return map;
//   }
// }
//
// class AssetInventoryBuilding {
//   int? buildingId;
//   String? buildingName;
//   List<AssetInventoryFloor> assetInventoryFloors = [];
//
//   AssetInventoryBuilding({
//     this.buildingId,
//     this.buildingName,
//     List<AssetInventoryFloor>? assetInventoryFloors,
//   }) {
//     this.assetInventoryFloors = assetInventoryFloors ?? [];
//   }
//
//   AssetInventoryBuilding.fromJson(Map<String, dynamic> json) {
//     buildingId = json['buildingId'];
//     buildingName = json['buildingName'];
//
//     if (json['assetInventoryFloors'] != null) {
//       assetInventoryFloors = (json['assetInventoryFloors'] as List).map((e) => AssetInventoryFloor.fromJson(e)).toList();
//     }
//   }
//
//   Map<String, dynamic> toJson() {
//     final map = <String, dynamic>{};
//     map['buildingId'] = buildingId;
//     map['buildingName'] = buildingName;
//     map['assetInventoryFloors'] = assetInventoryFloors.map((e) => e.toJson()).toList();
//     return map;
//   }
// }
//
// class AssetInventoryFloor {
//   int? floorId;
//   String? floorName;
//   List<AssetInventoryDepartment> assetInventoryDepartments = [];
//
//   AssetInventoryFloor({
//     this.floorId,
//     this.floorName,
//     List<AssetInventoryDepartment>? assetInventoryDepartments,
//   }) {
//     this.assetInventoryDepartments = assetInventoryDepartments ?? [];
//   }
//
//   AssetInventoryFloor.fromJson(Map<String, dynamic> json) {
//     floorId = json['floorId'];
//     floorName = json['floorName'];
//
//     if (json['assetInventoryDepartments'] != null) {
//       assetInventoryDepartments = (json['assetInventoryDepartments'] as List).map((e) => AssetInventoryDepartment.fromJson(e)).toList();
//     }
//   }
//
//   Map<String, dynamic> toJson() {
//     final map = <String, dynamic>{};
//     map['floorId'] = floorId;
//     map['floorName'] = floorName;
//     map['assetInventoryDepartments'] = assetInventoryDepartments.map((e) => e.toJson()).toList();
//     return map;
//   }
// }
//
// class AssetInventoryDepartment {
//   int? departmentId;
//   String? departmentName;
//   List<AssetInventoryRoom> assetInventoryRooms = [];
//
//   AssetInventoryDepartment({
//     this.departmentId,
//     this.departmentName,
//     List<AssetInventoryRoom>? assetInventoryRooms,
//   }) {
//     this.assetInventoryRooms = assetInventoryRooms ?? [];
//   }
//
//   AssetInventoryDepartment.fromJson(Map<String, dynamic> json) {
//     departmentId = json['departmentId'];
//     departmentName = json['departmentName'];
//
//     if (json['assetInventoryRooms'] != null) {
//       assetInventoryRooms = (json['assetInventoryRooms'] as List).map((e) => AssetInventoryRoom.fromJson(e)).toList();
//     }
//   }
//
//   Map<String, dynamic> toJson() {
//     final map = <String, dynamic>{};
//     map['departmentId'] = departmentId;
//     map['departmentName'] = departmentName;
//     map['assetInventoryRooms'] = assetInventoryRooms.map((e) => e.toJson()).toList();
//     return map;
//   }
// }
//
// class AssetInventoryRoom {
//   int? roomId;
//   String? roomName;
//
//   AssetInventoryRoom({this.roomId, this.roomName});
//
//   AssetInventoryRoom.fromJson(Map<String, dynamic> json) {
//     roomId = json['roomId'];
//     roomName = json['roomName'];
//   }
//
//   Map<String, dynamic> toJson() {
//     final map = <String, dynamic>{};
//     map['roomId'] = roomId;
//     map['roomName'] = roomName;
//     return map;
//   }
// }

class AssetInventoryAssignedEmployee {
  String? assignedEngineerId;
  String? assignedEngineerName;

  AssetInventoryAssignedEmployee({this.assignedEngineerId, this.assignedEngineerName});

  AssetInventoryAssignedEmployee.fromJson(Map<String, dynamic> json) {
    assignedEngineerId = json['assignedEngineerId'];
    assignedEngineerName = json['assignedEngineerName'];
  }

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['assignedEngineerId'] = assignedEngineerId;
    map['assignedEngineerName'] = assignedEngineerName;
    return map;
  }
}
