import 'package:krow_core/core.dart';
import 'package:krow_domain/krow_domain.dart';
import '../repositories/availability_repository.dart';

/// Use case to apply a quick-set availability pattern (e.g., "Weekdays", "All Week") to a week.
class ApplyQuickSetUseCase extends UseCase<ApplyQuickSetParams, List<DayAvailability>> {
  final AvailabilityRepository repository;

  ApplyQuickSetUseCase(this.repository);

  /// [type] can be 'all', 'weekdays', 'weekends', 'clear'
  @override
  Future<List<DayAvailability>> call(ApplyQuickSetParams params) {
    final end = params.start.add(const Duration(days: 6));
    return repository.applyQuickSet(params.start, end, params.type);
  }
}

/// Parameters for [ApplyQuickSetUseCase].
class ApplyQuickSetParams extends UseCaseArgument {
  final DateTime start;
  final String type;

  const ApplyQuickSetParams(this.start, this.type);

  @override
  List<Object?> get props => [start, type];
}
