import { ApiProperty } from "@nestjs/swagger"
import {
  IsString,
  IsInt,
  IsEmail,
  IsBoolean,
  IsNotEmpty,
  IsOptional,
} from "class-validator"
import { messageKey } from "src/constants/message-keys"
import { validationMessage } from "src/utils/helpers"

export class CreateHospitalDto {
  @ApiProperty({
    example: "Sunrise Medical Center",
    description: "Name of the hospital",
  })
  @IsString()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "name",
    }),
  })
  name: string

  @ApiProperty({
    example: "123 Main Street, Downtown",
    description: "Full address of the hospital",
  })
  @IsString()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "address",
    }),
  })
  address: string

  @ApiProperty({
    example: 101,
    description: "City ID referencing the cities table",
  })
  @IsInt()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "city",
    }),
  })
  city_id: number

  @ApiProperty({
    example: 5,
    description: "State ID referencing the states table",
  })
  @IsInt()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "state",
    }),
  })
  state_id: number

  @ApiProperty({
    example: 1,
    description: "Country ID referencing the countries table",
  })
  @IsInt()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "country",
    }),
  })
  country_id: number

  @ApiProperty({
    example: "560001",
    description: "Zip code of the hospital location",
  })
  @IsString()
  @IsOptional()
  zip_code: string

  @ApiProperty({
    example: "+91",
    description: "Country code of the hospital",
  })
  @IsString()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "country code",
    }),
  })
  country_code: string

  @ApiProperty({
    example: "9876543210",
    description: "Contact phone number of the hospital",
  })
  @IsString()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "phone number",
    }),
  })
  phone_number: string

  @ApiProperty({
    example: "info@sunrisemedical.com",
    description: "Official email of the hospital",
  })
  @IsEmail()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "email",
    }),
  })
  email: string

  @ApiProperty({
    example: true,
    description: "Flag to indicate if it is a partner hospital",
  })
  @IsBoolean()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "is_partner",
    }),
  })
  is_partner: boolean

  @ApiProperty({
    example: 1234,
    description: "Latitude coordinate of the hospital location",
  })
  @IsOptional()
  latitude: string

  @ApiProperty({
    example: 3321,
    description: "Longitude coordinate of the hospital location",
  })
  @IsOptional()
  longitude: string

  @ApiProperty({
    example: "ChIJN1t_tDeuEmsRUsoyG83frY4",
    description: "Google Place ID for the hospital location",
    required: false,
  })
  @IsOptional()
  place_id: string
}
