export type SourceType = "url" | "text" | "files";

export interface KnowledgeSourceConfig {
  /** For 'url' sources: list of URLs to index */
  urls?: string[];
  /** For 'text' sources: inline text content */
  texts?: Array<{ title: string; content: string }>;
  /** Embedding model override, defaults to 'nomic-embed-text' for ollama or 'text-embedding-3-small' for openai */
  embeddingModel?: string;
  /** Chunk size in characters (default 1000) */
  chunkSize?: number;
  /** Overlap between chunks in characters (default 100) */
  chunkOverlap?: number;
}

export interface DoclingConfig {
  /** Base URL of Docling Serve, e.g. http://localhost:5001 */
  url: string;
  /** Path for URL/source conversion — discovered from /openapi.json, defaults to /v1alpha/convert/source */
  sourceEndpoint?: string;
  /** Path for file upload conversion — discovered from /openapi.json, defaults to /v1alpha/convert/file */
  fileEndpoint?: string;
}

export interface KnowledgeFileAttachment {
  id: string;
  name: string;
  mimeType: string;
  size: number;
  /** Base64-encoded file content */
  content: string;
}

export interface Document {
  id: string;
  title: string;
  content: string;
  metadata?: Record<string, unknown>;
}

export interface Chunk {
  id: string;
  docId: string;
  docTitle: string;
  content: string;
  chunkIndex: number;
  metadata?: Record<string, unknown>;
}

export interface SyncResult {
  sourceId: string;
  docsProcessed: number;
  chunksCreated: number;
  errors: string[];
}
