import { Transform, Type } from 'class-transformer'; import { IsBoolean, IsEmail, IsIn, IsInt, IsOptional, IsString, Max, MaxLength, Min, MinLength, ValidateIf, } from 'class-validator'; export class CreateCompanySignatureInviteDto { @IsOptional() @Transform(({ value }) => typeof value === 'string' && value.trim() ? value.trim().toLowerCase() : undefined) @IsEmail() @MaxLength(320) recipientEmail?: string; @IsOptional() @Type(() => Number) @IsInt() @Min(1) @Max(30) expiresInDays?: number; } export class PublicCompanySignatureDto { @Transform(({ value }) => typeof value === 'string' ? value.trim() : value) @IsString() @MinLength(2) @MaxLength(200) fullName!: string; @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value) @IsString() @IsIn(['DNI', 'CUIL', 'PASSPORT', 'OTHER']) documentType!: string; @Transform(({ value }) => typeof value === 'string' ? value.trim() : value) @IsString() @MinLength(3) @MaxLength(40) documentNumber!: string; @Transform(({ value }) => typeof value === 'string' ? value.trim() : value) @IsString() @MinLength(2) @MaxLength(200) position!: string; @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value) @IsString() @IsIn(['CONFORMITY', 'DISSENT']) manifestation!: 'CONFORMITY' | 'DISSENT'; @ValidateIf((value: PublicCompanySignatureDto) => value.manifestation === 'DISSENT') @Transform(({ value }) => typeof value === 'string' ? value.trim() : value) @IsString() @MinLength(10) @MaxLength(8000) statement?: string; @Transform(({ value }) => value === true || value === 'true') @IsBoolean() consentAccepted!: boolean; } export class PublicCompanyRefusalDto { @Transform(({ value }) => typeof value === 'string' ? value.trim() : value) @IsString() @MinLength(2) @MaxLength(200) fullName!: string; @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value) @IsString() @IsIn(['DNI', 'CUIL', 'PASSPORT', 'OTHER']) documentType!: string; @Transform(({ value }) => typeof value === 'string' ? value.trim() : value) @IsString() @MinLength(3) @MaxLength(40) documentNumber!: string; @Transform(({ value }) => typeof value === 'string' ? value.trim() : value) @IsString() @MinLength(2) @MaxLength(200) position!: string; @Transform(({ value }) => typeof value === 'string' ? value.trim() : value) @IsString() @MinLength(10) @MaxLength(8000) reason!: string; }