import { ISO_DATE } from '@humand-packages/common';
import { Expose, Type } from 'class-transformer';
import { IsArray, IsOptional, IsString, MaxLength, ValidateNested } from 'class-validator';
import { IsValidDate } from '../../../../../middlewares/dateValidator';
import { RuleLogicVC } from './rulesVC';

export class UpdateHourCategoryVC {
    @IsOptional()
    @Expose()
    @IsString()
    @Expose()
    @MaxLength(255)
    name?: string;

    @IsOptional()
    @Expose()
    @IsString()
    @MaxLength(1000)
    description?: string;

    @IsOptional()
    @Expose()
    @IsString()
    @IsValidDate(ISO_DATE)
    effectiveFrom?: string;

    @IsOptional()
    @Expose()
    @IsArray()
    @ValidateNested({ each: true })
    @Type(() => RuleLogicVC)
    rules?: RuleLogicVC[];
}
