import { Controller, Get, Param, Query, UseGuards } from '@nestjs/common';
import { ServiceDoctorsService } from './service_doctors.service';
import { AuthGuard } from 'src/auth/auth.guard';
import { SkipThrottle, ThrottlerGuard } from '@nestjs/throttler';

@Controller('service_doctors')
export class ServiceDoctorsController {
  constructor(private readonly serviceDoctorsService: ServiceDoctorsService) { }
  @UseGuards(ThrottlerGuard)
  @SkipThrottle()
  @Get()
  findAll(@Query('date') date: string, @Query('gender') gender: string,
    @Query('speciality') speciality: string, @Query('language') language: string) {
    return this.serviceDoctorsService.findAll(date, gender, speciality, language);
  }
  @UseGuards(ThrottlerGuard)
  @SkipThrottle()
  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.serviceDoctorsService.findOne(+id);
  }
  //////////////pagination
  @UseGuards(AuthGuard, ThrottlerGuard)
  @SkipThrottle()
  @Get('/v2/list')
  findAlllist(@Query('date') date: string, @Query('gender') gender: string,
    @Query('speciality') speciality: string, @Query('language') language: string, @Query('limit') limit?: string,
    @Query('page') page?: string, @Query('search') search?: string) {
    return this.serviceDoctorsService.findAlldoctorlist(date, gender, speciality, language, +limit || 10, +page || 1, search);
  }
}
