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


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

  @ApiProperty({ example: 'Afghanistan', description: 'Name of the country' })
  name: string;

  @ApiProperty({ example: 'AF', description: 'ISO code of the country' })
  iso: string;

  @ApiProperty({ example: 'AFG', description: 'ISO3 code of the country' })
  iso3: string;

  @ApiProperty({ example: '93', description: 'Dial code of the country' })
  dial_code: string;

  @ApiProperty({ example: 'AFN', description: 'Currency code of the country' })
  currency: string;

  @ApiProperty({ example: 'Afghani', description: 'Currency name of the country' })
  currency_name: string;

  @ApiProperty({ example: '؋', description: 'Currency symbol of the country' })
  currency_symbol: string;

  @ApiProperty({ example: '', description: 'Country flag URL or base64 string' })
  country_flag: string;
}
@ApiTags('country code')
@Controller('country_code')
export class CountryCodeController {
  constructor(private readonly countryCodeService: CountryCodeService) { }

  @Get()
  @ApiOperation({ summary: 'Retrieve list of country codes' })
  @ApiResponse({
    status: 200,
    description: 'List of country codes retrieved successfully.',
    type: [CountryCodeDto], // Array of CountryCodeDto
  })
  @ApiResponse({
    status: 500,
    description: 'Internal server error',
    type: ErrorResponse500,
  })
  @ApiResponse({
    status: 400,
    description: 'Internal server error',
    type: ErrorResponse400,
  })
  findAll() {
    return this.countryCodeService.findAll();
  }

}
