import 'package:dartz/dartz.dart';
import '../../repositories/model_repository.dart';
import '../../../data/models/model/model_dto.dart';
import '../../../core/errors/failures.dart';
import '../base_usecase.dart';

/// 모델 목록 조회 파라미터
class GetModelsParams {
  final int page;
  final int perPage;
  final String? search;
  final int? vendorId;
  final bool? includeDeleted;

  const GetModelsParams({
    this.page = 1,
    this.perPage = 10,
    this.search,
    this.vendorId,
    this.includeDeleted,
  });
}

/// 모델 목록 조회 UseCase
class GetModelsUseCase extends UseCase<ModelListDto, GetModelsParams> {
  final ModelRepository _modelRepository;

  GetModelsUseCase(this._modelRepository);

  @override
  Future<Either<Failure, ModelListDto>> call(GetModelsParams params) async {
    return await _modelRepository.getModels(
      page: params.page,
      perPage: params.perPage,
      search: params.search,
      vendorId: params.vendorId,
      includeDeleted: params.includeDeleted,
    );
  }
}