import { Type } from "class-transformer"; import { IsNotEmpty, IsOptional, MinLength, ValidateNested } from "class-validator"; import { ContactChannelVO } from "./ContactChannelVO"; import { ContactCommand } from "./ContactCommand"; export class CreateContactCommand extends ContactCommand { static readonly commandName = "CreateContactCommand"; @IsOptional() @IsNotEmpty() public readonly name?: string; @IsOptional() @ValidateNested() @Type(() => ContactChannelVO) public readonly messagingChannel?: ContactChannelVO; constructor({ tenantId, contactId, name, messagingChannel, }: { tenantId: string; contactId: string; name?: string; messagingChannel?: ContactChannelVO; }) { super({ commandName: CreateContactCommand.commandName, tenantId, contactId, }); this.name = name; this.messagingChannel = messagingChannel; } }