import { ApiProperty } from "@nestjs/swagger"; import { Transform } from "class-transformer"; import { IsDefined, IsEmail, IsEnum, IsInt, IsNumber, IsString, Length, Min } from "class-validator"; import { YON } from "../property.dto"; // CONTACT // export class SP_CONTACTID_DTO { // @ApiProperty({ required: true }) // @Min(0, { message: 'Property p_spcontactid must be at least 0' }) // @IsInt({ message: 'Property p_SPid must be a whole number' }) // @Transform(({ value }) => Number(value)) // @IsNumber({}, { message: 'Property p_spcontactid must be a number' }) // @IsDefined({ message: 'Property p_spcontactid is required' }) // P_SPCONTACTID: number; // } // export class DEFAULT_CONTACT_FLAG_DTO { // @ApiProperty({ required: true, enum: YON }) // @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value) // @IsEnum(YON, { message: 'P_EnablePasswordPolicy must be either "Y" or "N"' }) // @Length(1, 1, { message: 'P_EnablePasswordPolicy must be between 5 and 6 characters' }) // @IsString() // @IsDefined({ message: "Invalid Request" }) // p_defcontactflag: YON; // } // export class FIRSTNAME_DTO { // @ApiProperty({ required: true }) // @IsString() // p_firstname: string; // } // export class LASTNAME_DTO { // @ApiProperty({ required: true }) // @IsString() // p_lastname: string; // } // export class MIDDLE_INITIAL_DTO { // @ApiProperty({ required: false }) // @IsString() // P_MIDDLEINITIAL: string; // } // export class TITLE_DTO { // @ApiProperty({ required: true }) // @IsString() // p_title: string; // } // export class PHONE_NO_DTO { // @ApiProperty({ required: true }) // @IsString() // p_phoneno: string; // } // export class MOBILE_NO_DTO { // @ApiProperty({ required: true }) // @IsString() // p_mobileno: string; // } // export class FAX_NO_DTO { // @ApiProperty({ required: true }) // @IsString() // p_faxno: string; // } // export class EMAIL_ADDRESS_DTO { // @ApiProperty({ required: true }) // @IsEmail() // p_emailaddress: string; // } export class SP_CONTACTID_DTO { @ApiProperty({ required: true }) @Min(0, { message: 'Property P_SPCONTACTID must be at least 0' }) @IsInt({ message: 'Property P_SPCONTACTID must be a whole number' }) @Transform(({ value }) => Number(value)) @IsNumber({}, { message: 'Property P_SPCONTACTID must be a number' }) @IsDefined({ message: 'Property P_SPCONTACTID is required' }) P_SPCONTACTID: number; } export class DEFAULT_CONTACT_FLAG_DTO { @ApiProperty({ required: true, enum: YON }) @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value) @IsEnum(YON, { message: 'P_DEFCONTACTFLAG must be either "Y" or "N"' }) @Length(1, 1, { message: 'P_DEFCONTACTFLAG must be between 5 and 6 characters' }) // Note: This message may not match actual length constraint @IsString() @IsDefined({ message: "Invalid Request" }) P_DEFCONTACTFLAG: YON; } export class FIRSTNAME_DTO { @ApiProperty({ required: true }) @Length(0, 50, { message: 'Property P_FIRSTNAME must be between 0 to 50 characters' }) @IsString({ message: 'Property FirP_FIRSTNAMEstName must be a string' }) @IsDefined({ message: 'Property P_FIRSTNAME is required' }) P_FIRSTNAME: string; } export class LASTNAME_DTO { @ApiProperty({ required: true }) @Length(0, 50, { message: 'Property P_LASTNAME must be between 0 to 50 characters' }) @IsString({ message: 'Property P_LASTNAME must be a string' }) @IsDefined({ message: 'Property P_LASTNAME is required' }) P_LASTNAME: string; } export class MIDDLE_INITIAL_DTO { @ApiProperty({ required: true }) @Length(0, 3, { message: 'Property P_MIDDLEINITIAL must be between 0 to 3 characters' }) @IsString({ message: 'Property P_MIDDLEINITIAL must be a string' }) P_MIDDLEINITIAL: string; } export class TITLE_DTO { @ApiProperty({ required: true }) @Length(0, 50, { message: 'Property P_TITLE must be between 0 to 50 characters' }) @IsString({ message: 'Property P_TITLE must be a string' }) P_TITLE: string; } export class PHONE_NO_DTO { @ApiProperty({ required: true }) @Length(0, 20, { message: 'Property P_PHONENO must be between 0 to 20 characters' }) @IsString({ message: 'Property P_PHONENO must be a string' }) @IsDefined({ message: 'Property P_PHONENO is required' }) P_PHONENO: string; } export class MOBILE_NO_DTO { @ApiProperty({ required: true }) @Length(0, 20, { message: 'Property P_MOBILENO must be between 0 to 20 characters' }) @IsString({ message: 'Property P_MOBILENO must be a string' }) @IsDefined({ message: 'Property P_MOBILENO is required' }) P_MOBILENO: string; } export class FAX_NO_DTO { @ApiProperty({ required: true }) @Length(0, 20, { message: 'Property FAXNO must be between 0 to 20 characters' }) @IsString({ message: 'Property FAXNO must be a string' }) P_FAXNO: string; } export class EMAIL_ADDRESS_DTO { @ApiProperty({ required: true }) @Length(0, 100, { message: 'Property P_EMAILADDRESS must be between 0 to 100 characters' }) @IsString({ message: 'Property P_EMAILADDRESS must be a string' }) @IsDefined({ message: 'Property P_EMAILADDRESS is required' }) P_EMAILADDRESS: string; }