import { Type } from "class-transformer";
import {
  IsBoolean,
  IsInt,
  IsOptional,
  IsString,
  MaxLength,
  Min,
  ValidateNested,
} from "class-validator";

import { DropdownOptionMetaDto } from "./dropdown-option-meta.dto";

export class CreateDropdownOptionDto {
  @IsString()
  @MaxLength(256)
  value!: string;

  @IsString()
  @MaxLength(256)
  label!: string;

  @IsOptional()
  @IsString()
  note?: string;

  @IsOptional()
  @IsBoolean()
  disabled?: boolean;

  @IsOptional()
  @IsInt()
  @Min(0)
  order?: number;

  @IsOptional()
  @ValidateNested()
  @Type(() => DropdownOptionMetaDto)
  meta?: DropdownOptionMetaDto;
}
