import { ArrayMaxSize, IsArray, IsNotEmpty, IsOptional, IsString, Matches, } from 'class-validator'; /** * DTO for domain availability check requests. * * Per T-03-05: domain input is validated with regex — only alphanumeric * characters and hyphens allowed, no dots, max 63 chars (DNS label limit). */ export class CheckDomainDto { @IsString() @IsNotEmpty() @Matches(/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/, { message: 'Domain must be a valid label: alphanumeric and hyphens only, 1-63 characters, cannot start or end with a hyphen', }) domain!: string; /** * Optional list of TLDs to check. If omitted, defaults are used. * Per T-03-06: max 10 TLDs per request to prevent DoS. */ @IsOptional() @IsArray() @IsString({ each: true }) @ArrayMaxSize(10, { message: 'Maximum 10 TLDs per request' }) tlds?: string[]; }