import { Controller, Get, Param, Query } from '@nestjs/common';
import { FilterSeasonTypeDto } from './dto/filter-season-type.dto';
import { Pagination } from 'src/core/response';
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
import { SeasonTypeEntity } from '../domain/entities/season-type.entity';
import { SeasonTypeReadOrchestrator } from '../domain/usecases/season-type-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.SEASON_TYPE.split('-').join(' ')} - read`)
@Controller(`v1/${MODULE_NAME.SEASON_TYPE}`)
@Public(false)
@ApiBearerAuth('JWT')
export class SeasonTypeReadController {
  constructor(private orchestrator: SeasonTypeReadOrchestrator) {}

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

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