import { ApiProperty } from '@nestjs/swagger'; import { IsNotEmpty, IsOptional, IsString, IsUUID, ValidateIf, } from 'class-validator'; export class CreateProductAllocationDto { @ApiProperty({ description: 'The name of the tag (if creating a new tag)', example: 'New Tag', }) @IsString() @IsNotEmpty() @ValidateIf((o) => !o.tagUuid) tagName: string; @ApiProperty({ description: 'UUID of the tag (if selecting an existing tag)', example: '123e4567-e89b-12d3-a456-426614174000', }) @IsUUID() @IsNotEmpty() @ValidateIf((o) => !o.tagName) tagUuid: string; @ApiProperty({ description: 'UUID of the product', example: '550e8400-e29b-41d4-a716-446655440000', }) @IsUUID() @IsOptional() productUuid: string; }