/**
 * Type definitions for the autofill dropzone feature.
 *
 * The autofill dropzone allows users to upload a source document (receipt, statement, etc.)
 * which is sent to a consumer-provided API endpoint for LLM-based data extraction.
 * The extracted data is then used to populate the group's child fields.
 */
import type { FormFileAttachment } from '../../types/file_attachment.js';
import type { FileUploadOptions } from '../../types/file_manager.js';
import type { ExternalUploadManager } from './external_upload_manager.js';
/**
 * Schema for a single field, sent to the autofill API so the LLM knows what to extract.
 */
export interface AutofillFieldSchema {
    /** Field identifier (used as key in response data) */
    field_id: string;
    /** Human-readable label */
    label: string;
    /** Component type (e.g., 'HazoCollabFormInputbox', 'HazoCollabFormDate', etc.) */
    component_type: string;
    /** Optional description for LLM context */
    description?: string;
    /** Input type hint (mixed, numeric, email, alpha) */
    input_type?: string;
    /** Options for radio/combo fields */
    input_options?: Array<{
        value: string;
        label: string;
    }>;
    /** Table configuration for data-table fields */
    table_config?: unknown;
}
/**
 * Request payload sent to the autofill API endpoint.
 */
export interface AutofillRequest {
    /** Uploaded file identifier */
    file_id: string;
    /** Original file name */
    file_name: string;
    /** File MIME type */
    mime_type: string;
    /** URL to download the file */
    download_url: string;
    /** Base64-encoded file content (sent directly to avoid needing to fetch download_url) */
    file_b64?: string;
    /** Group identifier */
    group_id: string;
    /** Prompt area for LLM context (e.g., 'tax_deductions') */
    prompt_area?: string;
    /** Prompt key for LLM context (e.g., 'd1_car_expenses') */
    prompt_key?: string;
    /** Field schemas describing what to extract */
    fields: AutofillFieldSchema[];
}
/**
 * Response from the autofill API endpoint.
 */
export interface AutofillResponse {
    /** Whether extraction was successful */
    success: boolean;
    /** Extracted data keyed by field_id. Values are strings, booleans, or arrays (for data-tables). */
    data: Record<string, unknown>;
    /** Error message if extraction failed */
    error?: string;
    /** Informational message (e.g., "No matching data found in this document.") */
    message?: string;
}
/**
 * Describes a conflict where autofill would overwrite an existing value.
 */
export interface OverwriteConflict {
    /** Field identifier */
    field_id: string;
    /** Human-readable label */
    label: string;
    /** Current value in the form */
    current_value: unknown;
    /** New value from autofill */
    new_value: unknown;
}
/**
 * Upload flow states for the dropzone UI.
 */
export type AutofillStatus = 'idle' | 'uploading' | 'extracting' | 'done' | 'done_empty' | 'error';
/**
 * Props for the AutofillDropzone component.
 */
export interface AutofillDropzoneProps {
    /** Group identifier */
    group_id: string;
    /** Field schemas for the group's child fields */
    fields: AutofillFieldSchema[];
    /** Consumer-provided API endpoint for LLM extraction */
    autofill_api_endpoint: string;
    /** Prompt area for LLM context */
    prompt_area?: string;
    /** Prompt key for LLM context */
    prompt_key?: string;
    /** Upload callback from file_manager */
    file_manager_upload: (file: File, options: FileUploadOptions) => Promise<FormFileAttachment>;
    /** Get download URL callback from file_manager */
    file_manager_get_download_url: (file_id: string, visibility?: 'public' | 'private') => string;
    /** Called with extracted data and the uploaded file attachment */
    on_autofill_complete: (data: Record<string, unknown>, attachment: FormFileAttachment) => void;
    /** Current form data for detecting overwrites */
    form_data: Record<string, unknown>;
    /** Whether the group is locked (disables the dropzone) */
    locked?: boolean;
    /** Optional background upload manager. When provided, files are submitted to this manager instead of the inline pipeline. */
    upload_manager?: ExternalUploadManager;
}
//# sourceMappingURL=types.d.ts.map