import { Controller, Get, Post, Param, Body } from '@nestjs/common'
import { ConflictChecksService } from './conflict-checks.service'
import { CreateConflictCheckDto } from './dto/create-conflict-check.dto'

@Controller('conflict-checks')
export class ConflictChecksController {
  constructor(private readonly service: ConflictChecksService) {}

  @Post()
  run(@Body() dto: CreateConflictCheckDto) {
    return this.service.run(dto)
  }

  @Get('folder/:clientFolderId')
  findForFolder(@Param('clientFolderId') clientFolderId: string) {
    return this.service.findForFolder(clientFolderId)
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.service.findOne(id)
  }

  @Post(':id/waive')
  waive(
    @Param('id') id: string,
    @Body('waiverRef') waiverRef: string,
    @Body('waivedBy') waivedBy: string,
  ) {
    return this.service.waive(id, waiverRef, waivedBy)
  }
}
