import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common';
import { CreateVersionPlanDto } from './dto/create-version-plan.dto';
import { UpdateVersionPlanDto } from './dto/update-version-plan.dto';
import { VersionPlanService } from './version-plan.service';

@Controller('versions/:versionId/plans')
export class VersionPlanController {
  constructor(private readonly versionPlanService: VersionPlanService) {}

  @Post()
  create(@Param('versionId') versionId: string, @Body() dto: CreateVersionPlanDto) {
    return this.versionPlanService.create(versionId, dto);
  }

  @Get()
  findAll(@Param('versionId') versionId: string) {
    return this.versionPlanService.findAll(versionId);
  }

  @Patch(':id')
  update(@Param('versionId') versionId: string, @Param('id') id: string, @Body() dto: UpdateVersionPlanDto) {
    return this.versionPlanService.update(versionId, id, dto);
  }

  @Patch(':id/complete')
  complete(@Param('versionId') versionId: string, @Param('id') id: string, @Body() dto: UpdateVersionPlanDto) {
    return this.versionPlanService.complete(versionId, id, dto);
  }

  @Delete(':id')
  remove(@Param('versionId') versionId: string, @Param('id') id: string) {
    return this.versionPlanService.remove(versionId, id);
  }
}
