/// Use case: Récupérer un budget par ID
library get_budget_by_id;

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

@lazySingleton
class GetBudgetById {
  final FinanceWorkflowRepository repository;

  GetBudgetById(this.repository);

  Future<Either<Failure, Budget>> call(String budgetId) async {
    if (budgetId.isEmpty) {
      return Left(ValidationFailure('ID budget requis'));
    }

    return await repository.getBudgetById(budgetId);
  }
}
