import type { HttpClient } from '@sisense/sdk-rest-client'; import type { NarrativeRequest, NarrativeResponse } from './narrative-api-types.js'; /** Unified narrative endpoint. Try first; fall back to legacy on 404. */ export declare const UNIFIED_NARRATIVE_ENDPOINT = "api/v2/ai/narrative"; /** Legacy endpoint (used when unified narrative returns 404). */ export declare const LEGACY_NARRATIVE_ENDPOINT = "api/v2/ai/nlg/queryResult"; /** * Options for getNarrative. All endpoint choice logic lives in this module. * * @internal */ export type GetNarrativeOptions = { canGenerateNarrativeViaAI?: boolean; /** * When provided and the primary request returns a 400, the request is retried once with this * fallback payload. Intended for trend/forecast stripping when the backend cannot handle them. */ fallbackRequestOn400?: NarrativeRequest; }; /** * Fetches Narrative. Single place for endpoint logic: when `canGenerateNarrativeViaAI` is truthy, * try the unified endpoint first and fall back to legacy on 404; otherwise hit legacy directly. * When `fallbackRequestOn400` is provided and the primary request returns a 400, the request is * retried once with the fallback payload. * * @param httpClient - HttpClient instance * @param request - Narration request payload * @param options - Optional; `canGenerateNarrativeViaAI` (typically from `app.settings.narrative`) * @returns Promise that resolves with narration JSON or `undefined` (same semantics as `HttpClient.post`) * @internal */ export declare function getNarrative(httpClient: HttpClient, request: NarrativeRequest, options?: GetNarrativeOptions): Promise;