import { Controller, Post, Body, Delete } from '@nestjs/common';
import { OpHubVitalsService } from './op-hub-vitals.service';
import { ApiOperation, ApiResponse } from '@nestjs/swagger';
import { ErrorResponse500 } from 'src/op-hub-appointment-status/op-hub-appointment-status.controller';
import { ErrorResponse400 } from 'src/op-hub-appointment/entities/op-hub-appointment.entity';
import { CreatePrescriptionResponseDto, GetPrescriptionResponseDto } from 'src/op-hub-prescription/op-hub-prescription.controller';
import { Vital } from './entities/op-hub-vital.entity';

@Controller('op-hub-vitals')
export class OpHubVitalsController {
  constructor(private readonly vitalsService: OpHubVitalsService) { }

  @Post('/post')
  @ApiOperation({ summary: 'Create a new prescription' })
  @ApiResponse({
    status: 201,
    description: 'The prescription has been successfully created.',
    type: CreatePrescriptionResponseDto,
  })
  @ApiResponse({
    status: 500,
    description: 'Internal server error',
    type: ErrorResponse500,
  })
  @ApiResponse({
    status: 400,
    description: 'Internal server error',
    type: ErrorResponse400,
  })
  create(@Body() createPrescriptionDto: Vital) {
    return this.vitalsService.create(createPrescriptionDto);
  }

  @Post('/get')
  @ApiOperation({ summary: 'Retrieve all prescriptions' })
  @ApiResponse({
    status: 200,
    description: 'List of all prescriptions retrieved successfully.',
    type: [GetPrescriptionResponseDto],
  })
  @ApiResponse({
    status: 500,
    description: 'Internal server error',
    type: ErrorResponse500,
  })
  @ApiResponse({
    status: 400,
    description: 'Internal server error',
    type: ErrorResponse400,
  })
  findAll(@Body() createPrescriptionDto: Vital) {
    return this.vitalsService.findAll(createPrescriptionDto);
  }

  @Post('/create-vitals')
  createVitals(@Body() vitalData: Vital) {
    return this.vitalsService.createVitals(vitalData);
  }
  @Post('/get-vitals')
  getVitals(@Body() vitalData: Vital) {
    return this.vitalsService.getVitals(vitalData);
  }

  @Post('/update-vitals')
  updateVitals(@Body() vitalData: Vital) {
    return this.vitalsService.updateVitals(vitalData);
  }
  @Post('/delete-vitals')
  deleteVitalsHard(@Body() vitalData: Vital) {
    return this.vitalsService.deleteVitalsHard(vitalData);
  }
}
