use param to send Update Api for unbookable to be bookable

This commit is contained in:
Rafeek-Khoudare
2025-07-07 15:40:49 +03:00
parent 387586f6f7
commit 35e9b606b2

View File

@ -0,0 +1,38 @@
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
class SendBookableSpacesToApiParams {
List<String> spaceUuids;
List<String> daysAvailable;
String startTime;
String endTime;
int points;
SendBookableSpacesToApiParams({
required this.spaceUuids,
required this.daysAvailable,
required this.startTime,
required this.endTime,
required this.points,
});
static SendBookableSpacesToApiParams fromBookableSpacesModel(
List<BookableSpacemodel> bookableSpaces) {
return SendBookableSpacesToApiParams(
spaceUuids: bookableSpaces.map((space) => space.spaceUuid).toList(),
daysAvailable: bookableSpaces
.expand((space) => space.spaceConfig.bookableDays)
.toSet()
.toList(),
startTime: bookableSpaces.first.spaceConfig.bookingStartTime,
endTime: bookableSpaces.first.spaceConfig.bookingEndTime,
points: bookableSpaces.first.spaceConfig.cost,
);
}
Map<String, dynamic> toJson() => {
'spaceUuids': spaceUuids,
'daysAvailable': daysAvailable,
'startTime': startTime,
'endTime': endTime,
'points': points
};
}