import { Type } from 'class-transformer'; import { IsIn, IsInt, IsNumber, IsOptional, IsString, Max, MaxLength, Min, MinLength, ValidateIf, } from 'class-validator'; import { ACTIVITY_POSTER_STATUSES } from '@dukang/shared-types'; import { PaginationQueryDto } from './admin-query.dto'; export class ActivityPosterQueryDto extends PaginationQueryDto { @IsOptional() @IsIn([...ACTIVITY_POSTER_STATUSES]) status?: string; } export class UpsertActivityPosterDto { @IsString() @MinLength(1) @MaxLength(128) title!: string; @IsOptional() @IsString() @MaxLength(4000) copyText?: string; @IsString() @MinLength(1) @MaxLength(512) imageUrl!: string; @Type(() => Number) @IsNumber() @Min(0) @Max(100) qrXPct!: number; @Type(() => Number) @IsNumber() @Min(0) @Max(100) qrYPct!: number; @Type(() => Number) @IsNumber() @Min(5) @Max(50) qrSizePct!: number; @IsOptional() @Type(() => Number) @IsInt() @Min(0) sortOrder?: number; @IsOptional() @IsIn([...ACTIVITY_POSTER_STATUSES]) status?: string; } export class UpdateActivityPosterStatusDto { @IsIn([...ACTIVITY_POSTER_STATUSES]) status!: string; } export class ActivityPosterSelectionDto { @IsOptional() @ValidateIf((_, value) => value != null) @IsString() posterId?: string | null; }