import { IsEmail, IsIn, IsOptional, IsString, Matches, MinLength, ValidateIf, } from 'class-validator'; import { BUSINESS_FIELDS } from '@mento/shared'; export class LoginDto { @IsOptional() @IsString() @MinLength(3) identifier?: string; @IsOptional() @IsEmail() email?: string; @IsString() @MinLength(6) password!: string; } export class LoginOtpRequestDto { @IsString() @Matches(/^09\d{9}$|^\+98\d{10}$|^98\d{10}$|^9\d{9}$/, { message: 'شماره موبایل معتبر نیست', }) mobile!: string; } export class LoginOtpVerifyDto { @IsString() challengeId!: string; @IsString() @MinLength(4) code!: string; } export class RegisterOrganizationDto { @IsString() @MinLength(2) organizationName!: string; @IsString() @MinLength(2) fullName!: string; @IsEmail() email!: string; @IsString() @Matches(/^09\d{9}$|^\+98\d{10}$|^98\d{10}$|^9\d{9}$/, { message: 'شماره موبایل معتبر نیست', }) mobile!: string; @IsString() @MinLength(6) password!: string; @IsString() @MinLength(6) passwordConfirm!: string; @IsIn([...BUSINESS_FIELDS]) businessField!: (typeof BUSINESS_FIELDS)[number]; @IsOptional() @IsString() referralCode?: string; @ValidateIf((_, v) => v !== undefined) @IsOptional() acceptedTerms?: boolean; } export class RegisterVerifyOtpDto { @IsString() challengeId!: string; @IsOptional() @IsString() @MinLength(4) emailCode?: string; @IsString() @MinLength(4) mobileCode!: string; } export class UpdateProfileDto { @IsString() @MinLength(2) fullName!: string; @IsEmail() email!: string; @IsString() @Matches(/^09\d{9}$|^\+98\d{10}$|^98\d{10}$|^9\d{9}$/, { message: 'شماره موبایل معتبر نیست', }) mobile!: string; }