import 'package:krow_core/core.dart';
import 'package:krow_domain/krow_domain.dart';
import '../arguments/get_payment_history_arguments.dart';
import '../repositories/payments_repository.dart';

/// Use case to retrieve payment history filtered by a period.
///
/// This use case delegates the data retrieval to [PaymentsRepository].
class GetPaymentHistoryUseCase extends UseCase<GetPaymentHistoryArguments, List<StaffPayment>> {

  /// Creates a [GetPaymentHistoryUseCase].
  GetPaymentHistoryUseCase(this.repository);
  final PaymentsRepository repository;

  @override
  Future<List<StaffPayment>> call(GetPaymentHistoryArguments arguments) async {
    return await repository.getPaymentHistory(arguments.period);
  }
}
