import { Controller, Get, Param, Query } from '@nestjs/common';
import { FilterVipCategoryDto } from './dto/filter-vip-category.dto';
import { Pagination } from 'src/core/response';
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
import { VipCategoryEntity } from '../domain/entities/vip-category.entity';
import { VipCategoryReadOrchestrator } from '../domain/usecases/vip-category-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_CATEGORY.split('-').join(' ')} - read`)
@Controller(`v1/${MODULE_NAME.VIP_CATEGORY}`)
@Public(false)
@ApiBearerAuth('JWT')
export class VipCategoryReadController {
  constructor(private orchestrator: VipCategoryReadOrchestrator) {}

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

  @Get(':id')
  async detail(@Param('id') id: string): Promise<VipCategoryEntity> {
    return await this.orchestrator.detail(id);
  }
}
