import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { IsBoolean, IsInt, IsObject, IsOptional, IsString, Max, Min, ValidateNested, } from 'class-validator'; import { Type } from 'class-transformer'; export class ProviderVideoSyncHistoryItemDto { @ApiProperty({ type: String, example: 'Provider Video Sync' }) title!: string; @ApiPropertyOptional({ type: Number, description: 'Epoch seconds for last run', }) runAt?: number; @ApiPropertyOptional({ type: Number, description: 'Epoch seconds for full sync completion', }) completedAt?: number; @ApiPropertyOptional({ type: Number, description: 'Known processed count (not stored yet)', }) processedCount: null = null; @ApiPropertyOptional({ type: String, description: 'Checkpoint cursor value stored in referId', }) updatedAtCursor?: string; @ApiPropertyOptional({ type: Number, description: 'syncState.updatedAt (epoch seconds)', }) updatedAt?: number; } export class ProviderVideoSyncHistoryDataDto { @ApiProperty({ type: [ProviderVideoSyncHistoryItemDto], description: 'Cursor records for provider sync', }) list!: ProviderVideoSyncHistoryItemDto[]; @ApiProperty({ type: Number, description: 'Total rows available' }) total!: number; } export class ProviderVideoSyncHistoryResponseDto { @ApiProperty({ type: ProviderVideoSyncHistoryDataDto, }) data!: ProviderVideoSyncHistoryDataDto; } class ProviderVideoSyncParamDto { @IsOptional() @IsString() status?: string; /** * ISO string; provider filters "updated after" * Example: "2025-12-18T21:19:09.227Z" */ @IsOptional() @IsString() updatedAt?: string; /** * Allow extra provider param keys without strict validation. * If you want to lock this down later, replace with explicit fields. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any [k: string]: any; } export class ProviderVideoSyncRunDto { @IsOptional() @IsString() providerCode?: string; @IsOptional() @IsBoolean() fullSync?: boolean; @IsOptional() @IsBoolean() resetState?: boolean; /** * Optional override. In normal usage: * - fullSync: resumes from SyncState cursor * - incremental: pageNum is forced to 1 */ @IsOptional() @IsInt() @Min(1) pageNum?: number; /** * Default is handled by service; capped at 500 by service. */ @IsOptional() @IsInt() @Min(1) @Max(15000) pageSize?: number; @IsOptional() @IsObject() @ValidateNested() @Type(() => ProviderVideoSyncParamDto) param?: ProviderVideoSyncParamDto; }