import 'package:dartz/dartz.dart';
import '../../repositories/equipment_repository.dart';
import '../../../core/errors/failures.dart';
import '../base_usecase.dart';

/// 장비 삭제 UseCase
class DeleteEquipmentUseCase extends UseCase<void, int> {
  final EquipmentRepository _equipmentRepository;

  DeleteEquipmentUseCase(this._equipmentRepository);

  @override
  Future<Either<Failure, void>> call(int equipmentId) async {
    if (equipmentId <= 0) {
      return Left(ValidationFailure(
        message: '올바르지 않은 장비 ID입니다.',
        errors: {'equipmentId': '장비 ID는 0보다 커야 합니다.'},
      ));
    }

    return await _equipmentRepository.deleteEquipment(equipmentId);
  }
}