import { Controller, Post, Body, Query, UseGuards } from "@nestjs/common";
import { CheckOldPatientService } from "./check-old-patient.service";
import { CheckOldPatient } from "./entities/check-old-patient.entity";
import { AuthGuard } from "src/auth/auth.guard";

@UseGuards(AuthGuard)
@Controller("check_old_patient")
export class CheckOldPatientController {
  constructor(
    private readonly checkOldPatientService: CheckOldPatientService
  ) { }

  @Post()
  findAll(@Body() Entity: CheckOldPatient) {
    console.log("hello");

    return this.checkOldPatientService.findAll(Entity);
  }

  @Post("v2")
  findAllV2(
    @Body() Entity: CheckOldPatient,
    @Query("limit") limit: number,
    @Query("page") page: number
  ) {
    console.log("hello");

    return this.checkOldPatientService.findAllV2(Entity, limit, page);
  }

  @Post("hos/v2")
  hosfindAllV2(
    @Body() Entity: CheckOldPatient,
    @Query("limit") limit: number,
    @Query("page") page: number
  ) {
    console.log("hellov2");

    return this.checkOldPatientService.hosfindAllV2(
      Entity,
      limit || 10,
      page || 1
    );
  }

  @Post("hos/v3")
  hosfindAllV3(
    @Body() Entity: CheckOldPatient,
    @Query("limit") limit: number,
    @Query("page") page: number
  ) {
    console.log("hello");

    return this.checkOldPatientService.hosfindAllV3(Entity, limit, page);
  }
}
