import { Controller, Post, Get, Delete, Param, Body } from '@nestjs/common'
import { ResumeService } from './resume.service'
import { CurrentUser } from '../../common/decorators/current-user.decorator'

@Controller('resume')
export class ResumeController {
  constructor(private resumeService: ResumeService) {}

  @Post('create')
  async create(
    @CurrentUser('userId') userId: string,
    @Body('title') title: string,
    @Body('content') content: string,
    @Body('targetPosition') targetPosition?: string,
  ) {
    return this.resumeService.create(userId, title, content, targetPosition)
  }

  @Get('list')
  async list(@CurrentUser('userId') userId: string) {
    return this.resumeService.list(userId)
  }

  @Get(':id')
  async getDetail(@Param('id') id: string, @CurrentUser('userId') userId: string) {
    return this.resumeService.getDetail(id, userId)
  }

  @Delete(':id')
  async delete(@Param('id') id: string, @CurrentUser('userId') userId: string) {
    return this.resumeService.delete(id, userId)
  }
}
