// Shared types for the copilot-export module (Demo-067 C, KAR-982). Kept
// dependency-free (no docx/exceljs/Supabase imports) so every builder and
// every server action can import from here without pulling in unrelated
// format-specific code.

/** Payload shape every server action returns for a generated file — same
 * "buffer -> base64 -> client download" contract (Muster B) the QAF 8-sheet
 * XLSX export already uses (see app/qaf-differences/actions.ts's
 * QafExportDownload). Kept local to this module (not imported from
 * actions.ts) — every actions.ts in this repo defines its own ActionResult
 * locally; this is the analogous per-module data payload. */
export interface CopilotExportDownload {
  filename: string
  /** base64-encoded file bytes (server actions can't stream a Blob). */
  base64: string
}

/** One glossary entry rendered in the AI-instruction block. */
export interface GlossaryEntry {
  term: string
  definition: string
}

export interface AiInstructionBlockInput {
  /** Document title, e.g. "Fabrikanalyse-Export". */
  exportTitle: string
  /** 1–3 sentences: what this document contains and where the data comes from. */
  aboutText: string
  /** Imperative bullet points: how an LLM/consultant should work with this file. */
  usageHints: readonly string[]
  /** Whether the source record belongs to a demo/showcase project
   * (`is_demo` on the underlying table) — controls the fictional-data
   * disclaimer. */
  isDemo: boolean
}

export interface AiInstructionBlockContent {
  heading: string
  aboutText: string
  usageHints: readonly string[]
  glossary: readonly GlossaryEntry[]
  glossaryHeading: string
  usageHeading: string
  /** null when the source record is not a demo project — callers must not
   * render a disclaimer section in that case. */
  disclaimer: string | null
}
