import { Transform } from 'class-transformer'
import { IsString, IsOptional, IsEnum, IsDateString } from 'class-validator'
import { SettingStatus } from 'generated/prisma/client'

export class CreateDetailDto {
    @IsString()
    headerId: string

    @IsString()
    code: string

    @IsString()
    name: string

    @IsOptional()
    @IsString()
    description?: string

    @IsDateString()
    beginEffective: string

    @IsOptional()
    @Transform(({ value }) => value === '' ? null : value)
    @IsDateString()
    endEffective?: string

    @IsOptional()
    @IsEnum(SettingStatus)
    status?: SettingStatus
}