import 'package:dartz/dartz.dart';
import '../../repositories/equipment_repository.dart';
import '../../../data/models/equipment/equipment_dto.dart';
import '../../../core/errors/failures.dart';
import '../base_usecase.dart';

/// 장비 상세 조회 UseCase
class GetEquipmentDetailUseCase extends UseCase<EquipmentDto, int> {
  final EquipmentRepository _equipmentRepository;

  GetEquipmentDetailUseCase(this._equipmentRepository);

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

    return await _equipmentRepository.getEquipmentDetail(equipmentId);
  }
}