Files
syncrow-app/lib/features/booking_system/domain/booking_model.dart
raf-dev1 dc123e6231 PR fixes
2025-06-17 14:14:16 +03:00

40 lines
1.0 KiB
Dart

class BookingModel {
final String uuid, roomName, date, timeSlot;
final int cost;
BookingModel({
required this.uuid,
required this.roomName,
required this.date,
required this.timeSlot,
required this.cost,
});
factory BookingModel.zero() => BookingModel(
uuid: '',
roomName: '',
date: '',
timeSlot: '',
cost: -1,
);
factory BookingModel.fromJson(Map<String, dynamic> json) => BookingModel(
uuid: json['uuid'] as String,
roomName: json['roomName'] as String,
date: json['date'] as String,
timeSlot: json['timeSlot'] as String,
cost: json['cost'] as int,
);
static List<BookingModel> fromJsonList(List<dynamic> jsonList) => jsonList
.map(
(bookModel) => BookingModel.fromJson(bookModel),
)
.toList();
Map<String, dynamic> toJson() => {
'uuid': uuid,
'roomName': roomName,
'date': date,
'timeSlot': timeSlot,
'cost': cost,
};
}