import { Body, Controller, Get, Param, Post, Req, UseGuards } from "@nestjs/common";
import { JwtAccessAuthGuard } from "src/middleware/auth/guard/access-token.guard";
import { ScheduleService } from "./schedule.service";
import * as DTO from './dto';
@UseGuards(JwtAccessAuthGuard)
@Controller('schedule')
export class ScheduleController {
  constructor(private readonly scheduleService: ScheduleService) {}

  @Post('/')
  async getList(@Req() req, @Body() data: DTO.ListRequest): Promise<DTO.ListResponse> {
    const result = await this.scheduleService.getList(req.user.id, data);
    return result;
  }

  @Get('/:id')
  async getDetail(@Param('id') id: string): Promise<DTO.DetailResponse> {
    const result = await this.scheduleService.getDetail(id);
    return result;
  }

  @Post('/create')
  async create(@Req() req, @Body() data: DTO.CreateRequest): Promise<DTO.CreateResponse> {
    const result = await this.scheduleService.create(req.user.id, data);
    return result;
  }
}