import 'package:comwell_key_app/presentation/screens/house_keeping/components/housekeeping_service.dart';
import 'package:json_annotation/json_annotation.dart';

part '../../.generated/domain/models/housekeeping.g.dart';

@JsonSerializable()
class Housekeeping {
  final String hotelCode;
  final String roomNumber;
  final bool cleaning;
  final bool soap;
  final bool towels;
  final bool trash;
  final bool refill;

  Housekeeping({
    required this.hotelCode,
    required this.roomNumber,
    required this.cleaning,
    required this.soap,
    required this.towels,
    required this.trash,
    required this.refill,
  });

  factory Housekeeping.toJson(
      String hotelCode, String roomNumber, List<HouseKeepingService> services) {
    return Housekeeping(
      hotelCode: hotelCode,
      roomNumber: roomNumber,
      cleaning: services.contains(HouseKeepingService.cleaning),
      soap: services.contains(HouseKeepingService.soap),
      towels: services.contains(HouseKeepingService.towels),
      trash: services.contains(HouseKeepingService.trash),
      refill: services.contains(HouseKeepingService.refill),
    );
  }
}