import type { AgentChatMessage } from "../../services/agentService";
import type { QuestionnaireParameters, QuestionnaireQuestion, QuestionnaireResult } from "../dialogs/agentDialogTypes";
import type { AgentSessionToolResultMessageApply } from "./agentSessionState";
export type QuestionnaireRecapStatus = "success" | "cancelled";
export interface QuestionnaireRecapOption {
    id: string;
    label: string;
}
export interface QuestionnaireRecapItem {
    id?: string;
    name?: string;
    path?: string;
    includeSubitems?: boolean;
}
export interface QuestionnaireRecapDocument {
    fileName: string;
    fileSize?: number;
    contentType?: string;
}
export interface QuestionnaireRecapRow {
    id: string;
    prompt: string;
    type: NonNullable<QuestionnaireQuestion["type"]>;
    optional: boolean;
    answered: boolean;
    selectedOptions: QuestionnaireRecapOption[];
    selectedItems: QuestionnaireRecapItem[];
    uploadedDocuments: QuestionnaireRecapDocument[];
    freetext?: string;
}
export interface QuestionnaireRecapData {
    title: string;
    description?: string;
    status: QuestionnaireRecapStatus;
    rows: QuestionnaireRecapRow[];
}
/**
 * Builds the read-only recap data for a completed (or cancelled)
 * ask-questionnaire tool call.
 *
 * The persisted functionResult is the bare QuestionnaireSuccessResult JSON
 * ({status, answerCount, answers: [{questionId, question, selectedOptions:
 * [{id,label}], selectedItems, uploadedDocuments, freetext}]}) with question
 * prompts and option labels already denormalized by the backend. The question
 * list (incl. skipped optional questions) comes from functionArguments;
 * when arguments are unparsable the rows are synthesized from the answers.
 *
 * Returns null when the tool call is not an ask-questionnaire call or has no
 * parsable result (e.g. validation errors surface via functionError only).
 */
export declare function parseQuestionnaireRecap(input: {
    functionName?: string;
    functionArguments?: unknown;
    functionResult?: unknown;
    functionError?: unknown;
}): QuestionnaireRecapData | null;
/**
 * Frontend mirror of the backend QuestionnaireAnswerSummaryBuilder: turns the
 * just-submitted QuestionnaireResult into the same QuestionnaireSuccessResult
 * JSON the backend persists as the tool call's functionResult. Used to bridge
 * the gap between submitting a questionnaire and the backend's toolResult
 * frame arriving, so the recap renders immediately.
 */
export declare function buildOptimisticQuestionnaireResultJson(parameters: QuestionnaireParameters | undefined, result: QuestionnaireResult | null): string;
/**
 * Builds the transcript apply payload for an optimistic questionnaire tool
 * result, or null when nothing should be applied: synthetic dialogs without a
 * toolCallId, no matching transcript tool call, or a call that already carries
 * a real result. Tool calls listed in reapplyToolCallIds hold a PRIOR
 * optimistic result and may be overwritten by a newer resolution (a replayed
 * dialog after a failed submit POST resolves a second time).
 */
export declare function buildOptimisticQuestionnaireToolResultApply(input: {
    transcript: AgentChatMessage[];
    request: {
        dialogType: string;
        toolCallId?: string;
        parameters?: unknown;
    };
    result: unknown | null;
    reapplyToolCallIds?: ReadonlySet<string>;
}): AgentSessionToolResultMessageApply | null;
