import type { RawRecord } from "@/lib/api/types"; export type CountMap = Record; export type ScoreItem = { label: string; score?: number | null; scoreLabel: string; detail?: string; weight?: number | null; group?: string; status?: string; }; export type ScoreThresholds = { pool_total?: number; pool_query?: number; review_total?: number; review_query?: number; walk_query?: number; walk_platform?: number; walk_total?: number; }; export type TechnicalRetryAttempt = { attempt?: number | null; status: string; durationSeconds?: number | null; failureType: string; exceptionType: string; httpStatusCode?: number | null; }; export type TechnicalRetryDetail = { briefReason: string; stage: string; stageLabel: string; failureType: string; failureLabel: string; exceptionType: string; httpStatusCode?: number | null; errorMessage: string; retryCount?: number | null; videoSource: string; timings: Record; sizes: Record; attempts: TechnicalRetryAttempt[]; oss: RawRecord; }; export type VideoRef = { id: string; contentDiscoveryId: string; platformContentId: string; title: string; author: string; platform: string; platformLabel: string; url?: string | null; ossUrl?: string | null; mediaStatus: string; mediaStatusLabel: string; mediaFailureReason?: string; tags: string[]; statistics: CountMap; decisionAction: string; decisionLabel: string; decisionReason: string; decisionReasonLabel: string; walkOutCount: number; score?: string; scoreItems: ScoreItem[]; scoreThresholds?: ScoreThresholds | null; raw: RawRecord; decision?: RawRecord; gemini?: RawRecord; technicalRetryDetail?: TechnicalRetryDetail | null; }; export type SourceSummary = { sourceKind: string; evidenceLabel: string; sourceRef: string; terms: string[]; details: string[]; raw?: RawRecord; }; export type QuerySummary = { id: string; text: string; method: string; sourceTerms: string[]; effectStatus: string; raw: RawRecord; clue?: RawRecord; }; export type RuleSummary = { total: number; passCount: number; reviewCount: number; technicalRetryCount: number; rejectCount: number; unknownCount: number; primaryReason: string; primaryReasonLabel: string; scoreLabel: string; scoreItems: ScoreItem[]; decisions: RawRecord[]; headline?: string; }; export type WalkSummary = { total: number; expansionCount: number; maxDepth: number; edgeCounts: CountMap; statusCounts: CountMap; stopReasons: CountMap; actions: RawRecord[]; }; export type AssetSummary = { assetCount: number; finalCount: number; pathCount: number; paths: RawRecord[]; reviewCount?: number; technicalRetryCount?: number; rejectCount?: number; headline?: string; }; export type DemandSummary = { id: string; name: string; description: string; reason: string; source: string; score?: string; date: string; type: string; itemsetIds: string[]; seedTerms: string[]; sourcePostId: string; support?: string; patternExecutionId: string; miningConfigId: string; categoryPaths: string[]; extractedPoints: string[]; categoryLeafTerms: string[]; }; export type FlowLedgerRow = { id: string; source: SourceSummary; query: QuerySummary; firstRoundVideos: VideoRef[]; firstRoundVideoTotal: number; videoStats: CountMap; duplicateCount: number; ruleSummary: RuleSummary; walkSummary: WalkSummary; finalAssets: AssetSummary; }; export type FlowLedger = { runId: string; dataOrigin: string; dataOriginLabel: string; summary: RawRecord; demandSummary?: DemandSummary; extensionQueries: RawRecord[]; rows: FlowLedgerRow[]; raw: { queries: RawRecord[]; contentItems: RawRecord[]; decisions: RawRecord[]; walkActions: RawRecord[]; sourcePaths: RawRecord[]; }; };