import 'package:syncrow_app/features/devices/model/room_model.dart'; import 'package:syncrow_app/utils/resource_manager/constants.dart'; class SpaceModel { final String? id; final String? name; final SpaceType type; late List? rooms; SpaceModel({ required this.type, required this.id, required this.name, required this.rooms, }); Map toJson() { return { 'id': id, 'name': name, 'rooms': rooms, }; } factory SpaceModel.fromJson(Map json) { return SpaceModel( id: json['uuid'], name: json['name'], type: spaceTypesMap[json['type']]!, rooms: [], ); } static List fromJsonList(List jsonList) { return jsonList.map((item) => SpaceModel.fromJson(item)).toList(); } }