mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-25 20:19:39 +00:00
40 lines
1.0 KiB
Dart
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,
|
|
};
|
|
}
|