/// Use case: Récupérer une approbation par ID
library get_approval_by_id;

import 'package:dartz/dartz.dart';
import 'package:injectable/injectable.dart';
import '../../../../core/error/failures.dart';
import '../entities/transaction_approval.dart';
import '../repositories/finance_workflow_repository.dart';

@lazySingleton
class GetApprovalById {
  final FinanceWorkflowRepository repository;

  GetApprovalById(this.repository);

  Future<Either<Failure, TransactionApproval>> call(String approvalId) async {
    if (approvalId.isEmpty) {
      return Left(ValidationFailure('ID approbation requis'));
    }

    return await repository.getApprovalById(approvalId);
  }
}
