import { Body, Controller, Get, Post, Query, UseGuards } from '@nestjs/common';
import { ConsultationStatusService } from './consultation.service';
import { Consultation } from './entities/consultation.entity';
import { AuthGuard } from 'src/auth/auth.guard';
import { SkipThrottle, ThrottlerGuard } from '@nestjs/throttler';

@Controller('consultationstatus')
export class ConsultationStatusController {
  constructor(private readonly ConsultationService: ConsultationStatusService) { }
  @UseGuards(AuthGuard, ThrottlerGuard)
  @Get()
  async findAll(@Query('hospital_id') hospital_id: number) {
    return this.ConsultationService.findAllColorCode(hospital_id);
  }
  @UseGuards(AuthGuard, ThrottlerGuard)
  @SkipThrottle()
  @Get('process')
  async findAllprocess(@Query('appointment_id') appointment_id: number) {
    return this.ConsultationService.findAllProcessList(appointment_id);
  }


  @UseGuards(AuthGuard, ThrottlerGuard)
  @SkipThrottle()
  @Get('tracking')
  async findAllprocesstrack(@Query('appointment_id') appointment_id: string) {
    return this.ConsultationService.findAllProcessTrackList(appointment_id);
  }

  @UseGuards(AuthGuard, ThrottlerGuard)
  @SkipThrottle()
  @Get('process_history')
  async findAllprocesstrackhistory(@Query('appointment_id') appointment_id: number) {
    return this.ConsultationService.ProcessTrackHistory(appointment_id);
  }

  @UseGuards(AuthGuard, ThrottlerGuard)
  @SkipThrottle()
  @Get('stats')
  async getConsultationProcessStats(@Query('appointment_id') appointment_id: string) {
    return this.ConsultationService.gettrackstats(appointment_id);
  }

  @UseGuards(AuthGuard, ThrottlerGuard)
  @SkipThrottle()
  @Post()
  async waitingPost(
    @Body() updateConsultation: Consultation,
  ): Promise<any> {
    return this.ConsultationService.createWaiting(updateConsultation);
  }


  @UseGuards(AuthGuard, ThrottlerGuard)
  @SkipThrottle()
  @Post('/check')
  async check(
    @Body() updateConsultation: Consultation,
  ): Promise<any> {
    return this.ConsultationService.checkbooked(updateConsultation);
  }


  @UseGuards(AuthGuard, ThrottlerGuard)
  @SkipThrottle()
  @Get('getAppointment')
  async getAppointment(@Query('patient_id') patient_id: number, @Query('hospital_id') hospital_id: number) {
    return this.ConsultationService.findAppointment(patient_id, hospital_id);
  }
}




