import { Controller, Post, Body, Req, UseGuards } from '@nestjs/common';
import { JobInvitationsService } from './job_invitations.service';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';

@ApiTags('Job Invitations')
@Controller('job-invitations')
export class JobInvitationsController {
  constructor(private readonly jobInvitationsService: JobInvitationsService) {}

  @Post()
  @UseGuards(JwtAuthGuard)
  @ApiBearerAuth('access-token')
  @ApiOperation({ summary: 'Invite a candidate to apply for a job' })
  async inviteCandidate(@Body() body: { job_post_id: number; seeker_id: number }, @Req() req: any) {
    const recruiter_id = req.user.userId;
    return this.jobInvitationsService.inviteCandidate({
      job_post_id: body.job_post_id,
      seeker_id: body.seeker_id,
      recruiter_id,
    });
  }
}
