import { IsNotEmpty, ValidateNested, IsEmail, IsDate, IsOptional, IsEnum, IsString } from 'class-validator' import { Type, Transform } from 'class-transformer' import { parseISO } from 'date-fns' import { LanguageCountryCode } from '../../../../utils/countries' export class PatientAttributes { @IsNotEmpty() document_number: string @IsNotEmpty() @IsEmail() email: string @IsNotEmpty() name: string @IsNotEmpty() @IsDate() @Transform(value => parseISO(value), { toClassOnly: true }) birth_date: Date @IsNotEmpty() cell_phone: string @IsOptional() @IsEnum(LanguageCountryCode) country_code?: LanguageCountryCode } export class SignUpInput { @IsNotEmpty() @ValidateNested() @Type(() => PatientAttributes) readonly patient: PatientAttributes @IsOptional() @IsString() app_signature?: string } export class SignUpParams { @IsNotEmpty() @ValidateNested() @Type(() => SignUpInput) readonly input: SignUpInput }