export const KNOWLEDGE_PLATFORMS = [
  "facebook",
  "linkedin",
  "instagram",
  "youtube",
  "twitter",
  "tiktok",
  "threads",
  "pinterest",
  "global",
] as const;

export type KnowledgePlatform = (typeof KNOWLEDGE_PLATFORMS)[number];

export type KnowledgeTopic =
  | "customer_audience"
  | "content"
  | "image"
  | "video"
  | "destination"
  | "cms_calendar"
  | "cms_categories"
  | "cms_team"
  | "cms_analytics"
  | "cms_rss"
  | "cms_strategy"
  | "general";

export interface KnowledgeChunk {
  id: string;
  docId: string;
  docType: string;
  platform: string;
  topic: KnowledgeTopic | string;
  sourceFile: string;
  sectionTitle: string;
  content: string;
  metadata?: Record<string, unknown>;
  embedding: number[];
}

export interface KnowledgeStore {
  version: number;
  platform: string;
  chunkCount: number;
  chunks: KnowledgeChunk[];
}

export interface KnowledgeHit {
  id: string;
  topic: string;
  sectionTitle: string;
  score: number;
  content: string;
  sourceFile: string;
}

export interface RagCitation {
  id: string;
  platform: KnowledgePlatform;
  topic: string;
  sectionTitle: string;
  score: number;
  sourceFile: string;
}

export interface RetrieveKnowledgeInput {
  platform: KnowledgePlatform;
  query: string;
  topK?: number;
  /** Boost similarity when chunk topic matches (e.g. content, image, video). */
  topicBoost?: KnowledgeTopic | KnowledgeTopic[];
}
