import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { VitalsService } from './vitals.service';
import { Vital } from './entities/vital.entity';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { CreatePrescriptionResponseDto, GetPrescriptionResponseDto } from 'src/prescription/prescription.controller';
import { ErrorResponse500 } from 'src/appointment_status/appointment_status.controller';
import { ErrorResponse400 } from 'src/appointment/entities/appointment.entity';

@ApiTags('vitals')
@Controller('vitals')
export class VitalsController {
  constructor(private readonly vitalsService: VitalsService) { }

  @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() createPrescriptionDto: Vital) {
    return this.vitalsService.postVitals(createPrescriptionDto);
  }

  @Post('/get-vitals')
  getVitals(@Body() createPrescriptionDto: Vital) {
    return this.vitalsService.getVitals(createPrescriptionDto);
  }
  @Post('/update-vitals')
  updateVitals(@Body() createPrescriptionDto: Vital) {
    return this.vitalsService.updateVitals(createPrescriptionDto);
  }
  @Post('/delete-vitals')
  deleteVitals(@Body() createPrescriptionDto: Vital) {
    return this.vitalsService.deleteVitals(createPrescriptionDto);
  }
}
