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

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

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