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

/// 장비 목록 조회 파라미터
class GetEquipmentsParams {
  final int page;
  final int perPage;
  final String? search;

  const GetEquipmentsParams({
    this.page = 1,
    this.perPage = AppConstants.equipmentPageSize,
    this.search,
  });
}

/// 장비 목록 조회 UseCase
class GetEquipmentsUseCase extends UseCase<PaginatedResponse<EquipmentDto>, GetEquipmentsParams> {
  final EquipmentRepository _equipmentRepository;

  GetEquipmentsUseCase(this._equipmentRepository);

  @override
  Future<Either<Failure, PaginatedResponse<EquipmentDto>>> call(GetEquipmentsParams params) async {
    return await _equipmentRepository.getEquipments(
      page: params.page,
      limit: params.perPage,
      search: params.search,
    );
  }
}