import { Controller, Get } from '@nestjs/common';
import { BloodGroupService } from './blood-group.service';
import { ApiOperation, ApiProperty, ApiResponse, ApiTags } from '@nestjs/swagger';
import { ErrorResponse400 } from 'src/appointment/entities/appointment.entity';
import { ErrorResponse500 } from 'src/appointment_status/appointment_status.controller';


export class BloodGroupDto {
  @ApiProperty({ example: 1, description: 'ID of the blood group' })
  id: number;

  @ApiProperty({ example: 'A+ve', description: 'Name of the blood group' })
  name: string;
}

@ApiTags('blood-group-list')
@Controller('blood_group')
export class BloodGroupController {
  constructor(private readonly bloodGroupService: BloodGroupService) { }

  @Get()
  @ApiOperation({ summary: 'Retrieve list of blood groups' })
  @ApiResponse({
    status: 200,
    description: 'List of blood groups retrieved successfully.',
    type: [BloodGroupDto], 
  })
  @ApiResponse({
    status: 500,
    description: 'Internal server error',
    type: ErrorResponse500,
  })
  @ApiResponse({
    status: 400,
    description: 'Internal server error',
    type: ErrorResponse400,
  })
  findAll() {
    return this.bloodGroupService.findAll();
  }

}
