import { Controller, Get, Query, ParseIntPipe } from '@nestjs/common';
import { JobMatchesService } from '../job_matches/job_matches.service';
import {
  ApiBearerAuth,
  ApiTags,
  ApiOperation,
  ApiQuery,
} from '@nestjs/swagger';

@ApiTags('seeker/job_alerts')
@ApiBearerAuth('access-token')
@Controller('seeker/job_alerts')
export class JobAlertsController {
  constructor(private readonly jobMatchesService: JobMatchesService) {}

  @Get()
  @ApiOperation({ summary: 'Get seeker job alerts' })
  @ApiQuery({ name: 'seeker_id', type: Number, required: true })
  @ApiQuery({ name: 'page', type: String, required: false })
  @ApiQuery({ name: 'limit', type: String, required: false })
  @ApiQuery({ name: 'match_type', type: String, required: false })
  @ApiQuery({ name: 'title', type: String, required: false })
  async getSeekerJobAlerts(
    @Query('seeker_id', ParseIntPipe) seekerId: number,
    @Query('page') page: string = '1',
    @Query('limit') limit: string = '10',
    @Query('match_type') matchType?: string,
    @Query('title') title?: string,
  ) {
    return this.jobMatchesService.getSeekerJobAlerts(
      seekerId,
      parseInt(page),
      parseInt(limit),
      matchType,
      title,
    );
  }
}
