import { ApiProperty } from "@nestjs/swagger"
import { IsNotEmpty, IsString, IsInt } from "class-validator"
import { Transform } from "class-transformer"

export class CreateCurrencyDto {
  @ApiProperty({
    description: "The code of the currency",
    example: "INR",
  })
  @IsString({ message: "Currency code must be a string." })
  @IsNotEmpty({ message: "Currency code cannot be empty." })
  @Transform(({ value }) => value.toUpperCase())
  currency_code: string

  @ApiProperty({
    description: "The name of the currency",
    example: "Indian Rupee",
  })
  @IsString({ message: "Currency name must be a string." })
  @IsNotEmpty({ message: "Currency name cannot be empty." })
  name: string

  @ApiProperty({
    description: "The symbol of the currency",
    example: "₹",
  })
  @IsString({ message: "Currency symbol must be a string." })
  @IsNotEmpty({ message: "Currency symbol cannot be empty." })
  symbol: string

  @ApiProperty({
    description: "The country ID to which the currency belongs",
    example: 1,
  })
  @IsInt({ message: "Country ID must be an integer." })
  @IsNotEmpty({ message: "Country ID cannot be empty." })
  country_id: number
}
