import 'package:test_sa/models/base.dart';

class Rooms extends Base {
  int? id; // Now nullable
  @override
  String? name; // Now nullable
  int?value; // Now nullable

  Rooms({this.id, this.name, this.value}) : super(identifier: id?.toString() ?? '', name: name); // Handle potential null id

  Rooms.fromJson(Map<String, dynamic>? json) {
    // Handle potential null json input
    id = json?['id']?? json?['roomId'];
    name = json?['name']??json?['roomName'];
    value = json?['value'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['name'] = name;
    data['value'] = value;
    return data;
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is Rooms &&
          runtimeType == other.runtimeType &&
          id == other.id;

  @override
  int get hashCode => id.hashCode;
}

// class Rooms extends Base {
//   int? id; // Now nullable
//   int? departmentId; // Now nullable
//   int? clientRoomId; // Now nullable
//   String? roomName; // Now nullable
//
//   Rooms({this.id, this.departmentId, this.clientRoomId, this.roomName}) : super(identifier: id?.toString() ?? '', name: roomName); // Handle potential null id
//
//   Rooms.fromJson(Map<String, dynamic>? json) { // Handle potential null json input
//     id = json?['id']; // Use null-aware operator
//     departmentId = json?['departmentId'];
//     clientRoomId = json?['clientRoomId'];
//     roomName = json?['roomName'];
//   }
//
//   Map<String, dynamic> toJson() {
//     final Map<String, dynamic> data = new Map<String, dynamic>();//     data['id'] = this.id;
//     data['departmentId'] = this.departmentId;
//     data['clientRoomId'] = this.clientRoomId;
//     data['roomName'] = this.roomName;
//     return data;
//   }
// }