import { Controller, Get, Query } from '@nestjs/common';
import { FilterVipCodeDto } from './dto/filter-vip-code.dto';
import { Pagination } from 'src/core/response';
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
import { VipCodeEntity } from '../domain/entities/vip-code.entity';
import { VipCodeReadOrchestrator } from '../domain/usecases/vip-code-read.orchestrator';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
import { Public } from 'src/core/guards';

@ApiTags(`${MODULE_NAME.VIP_CODE.split('-').join(' ')} - read`)
@Controller(`v1/${MODULE_NAME.VIP_CODE}`)
@Public(false)
@ApiBearerAuth('JWT')
export class VipCodeReadController {
  constructor(private orchestrator: VipCodeReadOrchestrator) {}

  @Get()
  @Pagination()
  async index(
    @Query() params: FilterVipCodeDto,
  ): Promise<PaginationResponse<VipCodeEntity>> {
    return await this.orchestrator.index(params);
  }
}
