import { Controller, Get, Post, Body, Param, Put } from '@nestjs/common';
import { JobPostAiSettingsService } from './job_post_ai_settings.service';
import { JobPostAiSettings } from './entities/job_post_ai_settings.entity';
import { Public } from '../auth/public.decorator';
import {
  ApiTags,
  ApiBearerAuth,
  ApiOperation,
  ApiBody,
  ApiParam,
} from '@nestjs/swagger';

@ApiTags('job_post_ai_settings')
@ApiBearerAuth('access_token')
@Controller('job_post_ai_settings')
export class JobPostAiSettingsController {
  constructor(
    private readonly jobPostAiSettingsService: JobPostAiSettingsService,
  ) {}

  @Public()
  @Post()
  @ApiOperation({ summary: 'Create or update AI settings' })
  @ApiBody({ type: JobPostAiSettings })
  async createOrUpdate(@Body() data: Partial<JobPostAiSettings>) {
    return this.jobPostAiSettingsService.createOrUpdate(data);
  }

  @Public()
  @Get(':jobPostId')
  @ApiOperation({ summary: 'Get AI settings by job post ID' })
  @ApiParam({ name: 'jobPostId', type: Number })
  async findByJobPostId(@Param('jobPostId') jobPostId: number) {
    return this.jobPostAiSettingsService.findByJobPostId(jobPostId);
  }
}
