import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/services/api.dart';
import 'package:comwell_key_app/services/mappers/booking_mapper.dart';
import 'package:flutter/material.dart';
class ShareBookingRepository {
final Api api = Api();
ShareBookingRepository();
Future<String?> createRoomSharingLink(
String hmsConfirmationNumber, String hotelCode, int sharingType) async {
try {
final link = await api.createRoomSharingLink(
hmsConfirmationNumber, hotelCode, sharingType);
return link;
} catch (e) {
debugPrint("Error creating room sharing link: $e");
return null;
}
}
Future<Booking> consumeRoomSharingLink(
String sharingId, String hotelCode) async {
try {
final response = await api.consumeRoomSharingLink(sharingId, hotelCode);
return response.toBooking();
} catch (e) {
throw Exception(e);
}
}
Future<void> removeGuestsFromBooking(
String hmsConfirmationNumber, String hotelCode, int guestId) async {
try {
await api.removeGuestsFromBooking(hmsConfirmationNumber, hotelCode, guestId);
} catch (e) {
throw Exception(e);
}
}
}