import 'package:cargocalculaterapp/core/error/failure.dart';
import 'package:cargocalculaterapp/core/usecase/usecase.dart';
import 'package:cargocalculaterapp/features/calculator/data/model/calculate_price_response.dart';
import 'package:cargocalculaterapp/features/calculator/data/model/price_calculate_request.dart';
import 'package:dartz/dartz.dart';

import '../repository/calculator_repository.dart';

class CalculatePriceUseCase
    extends UseCase<CalculatePriceResponse, PriceCalculateRequest> {
  final CalculatorRepository repository;

  CalculatePriceUseCase(this.repository);

  @override
  Future<Either<Failure, CalculatePriceResponse>> call(
    PriceCalculateRequest params,
  ) async {
    return await repository.calculatePrice(params);
  }
}
