/**
 * Collaboration form set component
 * Dynamically generates forms from JSON configuration
 * Supports nested groups, field dependencies, and all HazoCollabForm component types
 */
import React from 'react';
import { type DataTableConfig, type TooltipConfig } from './hazo_collab_form_data_table.js';
import type { NoteEntry, FieldValidatorValue, ChatStatusColorsConfig } from './hazo_collab_form_base.js';
import type { FormFileAttachment } from '../types/file_attachment.js';
import type { FileManagerConfig } from '../types/file_manager.js';
import { type NewFieldDefinition, type DialogComponents, type ComboboxComponents } from './hazo_add_field_dialog/index.js';
import type { IconsBehaviour } from '../types/icons_behaviour.js';
import { type ExternalUploadManager } from './autofill_dropzone/index.js';
import type { FileAcceptMode } from '../types/file_accept_mode.js';
import type { FieldMetadataInput, ConfirmState } from './shared/field_state/index.js';
import { normalize_field_metadata_input } from './shared/field_state/index.js';
export type { FieldMetadataInput, ConfirmState };
export { normalize_field_metadata_input };
/**
 * Input option for radio, checkbox, or combo components
 */
export interface InputOption {
    /**
     * Label text for the option
     */
    label: string;
    /**
     * Value of the option
     */
    value: string;
}
/**
 * Input format configuration for validation
 */
export interface InputFormat {
    /**
     * Format guide text to display
     */
    format_guide?: string;
    /**
     * Minimum text length
     */
    text_min_len?: number;
    /**
     * Maximum text length
     */
    text_max_len?: number;
    /**
     * Minimum numeric value
     */
    num_min?: number;
    /**
     * Maximum numeric value
     */
    num_max?: number;
    /**
     * Regular expression pattern for validation
     */
    regex?: string;
    /**
     * Number of decimal places allowed
     */
    num_decimals?: number;
}
/**
 * Field configuration - can be a regular field or a group
 */
export interface FieldConfig {
    /**
     * Unique identifier for the field
     */
    id: string;
    /**
     * Label text for the field
     */
    label: string;
    /**
     * Field type: "field" for regular fields, "group" for groups
     */
    field_type: 'field' | 'group';
    /**
     * Description text for the field
     */
    description?: string;
    /**
     * Tooltip text or configuration to display on hover
     * Can be a simple string or full TooltipConfig object
     * When provided, shows a help icon next to the label
     */
    tooltip?: string | TooltipConfig;
    /**
     * Context key for hazo_ihelp inline help icon in the label.
     * Requires hazo_ihelp and IhelpProvider in the component tree.
     */
    ihelp_context_key?: string;
    /**
     * Component type (only for field_type: "field")
     * One of: HazoCollabFormInputbox, HazoCollabFormRadio, HazoCollabFormCheckbox, HazoCollabFormCombo, HazoCollabFormTextArea, HazoCollabFormDate
     */
    component_type?: string;
    /**
     * Current value of the field
     */
    value: string | boolean;
    /**
     * Input type for validation (mixed, numeric, email, alpha)
     */
    input_type?: 'mixed' | 'numeric' | 'email' | 'alpha';
    /**
     * Public file accept mode for this field/group.
     * - 'none': No public file UI (default)
     * - 'ai_upload': LLM autofill dropzone (groups only, requires prompt_area + prompt_key)
     * - 'basic_upload': Standard file upload accordion
     */
    accept_public_files?: FileAcceptMode;
    /**
     * Private file accept mode for this field/group.
     * - 'none': No private file UI (default)
     * - 'basic_upload': Standard private file upload accordion
     * Note: 'ai_upload' is not supported for private files.
     * Gated by `control_private_files.visible` in `icons_behaviour` roles
     */
    accept_private_files?: FileAcceptMode;
    /** @deprecated Use accept_public_files instead. Boolean true maps to 'basic_upload'. */
    accept_files_public?: boolean;
    /** @deprecated Use accept_private_files instead. Boolean true maps to 'basic_upload'. */
    accept_files_private?: boolean;
    /**
     * Server directory path where files should be saved
     */
    files_dir?: string;
    /**
     * Maximum file size in bytes per file
     */
    max_size?: number;
    /**
     * Minimum number of files required
     * When >= 1, displays a required indicator on the Files accordion
     */
    min_files?: number;
    /**
     * Maximum number of files allowed
     */
    max_files?: number;
    /**
     * File type accept attribute (e.g., "image/*", ".pdf,.doc")
     */
    file_accept?: string;
    /**
     * Custom file validator callback
     * Called before file upload to validate each file
     * Returns error string to reject file, null to accept
     * Note: For JSON configs, this must be passed via a callback prop
     */
    file_validator?: (file: File) => string | null;
    /**
     * Permission string required to view/upload private files
     * Uses hazo_auth permission checking
     * Required when accept_private_files is 'basic_upload'
     */
    private_files_permission?: string;
    /**
     * Override permission check for private files
     * When true, bypasses hazo_auth permission check and shows private files section
     * Useful for testing or when permission is already verified by parent component
     */
    can_access_private_files?: boolean;
    /**
     * Custom field value validator callback
     * Called on value change to validate the field value
     * Returns error string to show error, null if valid
     * Supports: string, boolean, Date, DateRangeValue, null
     * Note: For JSON configs, this must be passed via a callback prop
     */
    field_validator?: (value: FieldValidatorValue) => string | null;
    /**
     * Input format configuration
     */
    input_format?: InputFormat;
    /**
     * Input options for radio, checkbox, or combo components
     */
    input_options?: InputOption[];
    /**
     * Child fields for group type fields
     */
    fields?: FieldConfig[];
    /**
     * Dependency condition (e.g., "field_id:value")
     * Field will only be shown if the dependency field has the specified value
     */
    dependency?: string;
    /**
     * Input width: "auto" for auto width, "full" for full width
     */
    input_width?: 'auto' | 'full';
    /**
     * Whether this field is required
     * When true, displays a red asterisk next to the label
     */
    required?: boolean;
    /**
     * Whether to enable notes for this field
     * When true, displays a notes icon that allows users to add/view notes
     */
    enable_notes?: boolean;
    /**
     * Whether to enable chat for this field
     * When true, displays a chat icon that allows users to open field chat
     * Can be set at group level to propagate to all child fields
     */
    enable_chat?: boolean;
    /**
     * Chat read-only mode for this field (v4.0.4+)
     * When true, chat input is hidden for view-only mode
     * Overrides form-level chat_read_only setting
     */
    chat_read_only?: boolean;
    /**
     * Array of notes for this field
     * Each note contains user info, timestamp, and note content
     */
    notes?: NoteEntry[];
    /**
     * Reference value to display in a tag below the field input
     * If provided, displays in format "reference_label: reference_value" or just "reference_value"
     */
    reference_value?: string;
    /**
     * Reference label to display in a tag below the field input
     * If provided alone, displays just "reference_label"
     * If provided with reference_value, displays "reference_label: reference_value"
     */
    reference_label?: string;
    /**
     * Background color class for the reference tag
     * Default: "bg-muted"
     */
    reference_tag_background_color?: string;
    /**
     * Table configuration (only for component_type: "HazoCollabFormDataTable")
     * Defines columns, settings, and behavior for data table fields
     */
    table_config?: DataTableConfig;
    /**
     * Whether to enable data OK controls for this field
     * When false, the data OK checkbox/selector will not be shown
     * Overrides the form-level enable_data_ok setting if provided.
     */
    enable_data_ok?: boolean;
    /**
     * Whether the data OK checkbox is editable (clickable) for this field
     * When false, the checkbox is disabled (read-only).
     * Overrides the form-level data_ok_editable setting if provided.
     * Default: inherits from form-level setting
     */
    data_ok_editable?: boolean;
    /**
     * Data OK display mode for this field
     * - 'checkbox': Binary checkbox (OK/Not OK) - default, backward compatible
     * - 'multi_state': Three-state selector (OK/Not OK/Pending) with click-cycle and dropdown
     * Overrides the form-level data_ok_mode setting if provided.
     */
    data_ok_mode?: 'checkbox' | 'multi_state';
    /**
     * Default value for the data OK for this field
     * - boolean: For checkbox mode (true = checked, false = unchecked)
     * - 'ok' | 'not_ok' | 'pending': For multi_state mode
     * Overrides the form-level data_ok_default setting if provided.
     */
    data_ok_default?: boolean | 'ok' | 'not_ok' | 'pending';
    /**
     * States to hide from user selection for this field.
     * Hidden states will still display if current value matches,
     * but cannot be selected via click-cycle or dropdown.
     * Overrides form-level data_ok_hidden_states if provided.
     * @example ['pending'] - Users can only select 'ok' or 'not_ok'
     */
    data_ok_hidden_states?: DataOkState[];
    /**
     * Whether to enable visibility toggle for this field
     * When true, displays a visibility icon that allows toggling field visibility
     */
    enable_visibility_toggle?: boolean;
    /**
     * Current visibility state
     * - 'visible': Field is visible to all users (default)
     * - 'hidden': Field is hidden from responders but visible to authors
     */
    visibility?: 'visible' | 'hidden';
    /**
     * Whether this field supports additional entries (cloning)
     * When true, shows "+" icon to add duplicate entries below
     */
    additional_entry?: boolean;
    /**
     * Maximum number of additional entries allowed
     * Default: 10
     */
    max_additional_entries?: number;
    /**
     * Whether to enable delete for this field
     * When true, displays a delete icon that allows soft-deleting the field
     */
    enable_delete?: boolean;
    /**
     * Whether to enable lock for this field
     * When true, displays a lock icon that allows locking/unlocking the field
     */
    enable_lock?: boolean;
    /**
     * Current lock state
     * When true, the field is read-only (cannot be edited)
     */
    locked?: boolean;
    /**
     * Whether to enable skip/N/A for this field
     * When true, displays a N/A icon that allows marking the field as not applicable
     */
    enable_skip?: boolean;
    /**
     * Current skip state
     * When true, the field is marked as not applicable (N/A)
     */
    skipped?: boolean;
    /**
     * Display mode for edit action icons (lock, visibility, delete)
     * - 'auto': Show single icon when only one action enabled, dropdown when multiple (default)
     * - 'separate': Always show individual icons side by side
     * - 'dropdown': Always show consolidated 3-dots dropdown menu
     * Overrides form-level edit_actions_display if provided
     */
    edit_actions_display?: 'auto' | 'separate' | 'dropdown';
    /**
     * Include chat icon in the consolidated 3-dots dropdown menu
     * When true, chat icon moves into the edit actions dropdown
     * Overrides form-level include_chat_in_dropdown if provided
     */
    include_chat_in_dropdown?: boolean;
    /**
     * Include notes icon in the consolidated 3-dots dropdown menu
     * When true, notes icon moves into the edit actions dropdown
     * Overrides form-level include_notes_in_dropdown if provided
     */
    include_notes_in_dropdown?: boolean;
    /**
     * Extract chat icon from dropdown when it has messages
     * Only applies when include_chat_in_dropdown=true
     * Overrides form-level extract_active_chat if provided
     */
    extract_active_chat?: boolean;
    /**
     * Extract notes icon from dropdown when notes exist
     * Only applies when include_notes_in_dropdown=true
     * Overrides form-level extract_active_notes if provided
     */
    extract_active_notes?: boolean;
    /**
     * @deprecated Use `show_edit_icons` and `show_control_icons` instead.
     * When set, acts as fallback for both: `show_edit_icons ?? show_icons`, `show_control_icons ?? show_icons`.
     * Icons now show automatically based on role config in `icons_behaviour` - this override is only
     * needed to force-hide icons on specific fields/groups.
     */
    show_icons?: boolean;
    /**
     * Override for edit icon visibility (control_edit_field, control_edit_group, control_delete_field).
     * - `undefined` (default): edit icons show based on role config in `icons_behaviour`
     * - `false`: force-hide edit icons on this field/group regardless of role config
     * Falls back to `show_icons` if not set.
     */
    show_edit_icons?: boolean;
    /**
     * Override for control icon visibility (data_ok, skip, notes, chat, lock, visibility, delete, private_files).
     * - `undefined` (default): control icons show based on role config in `icons_behaviour`
     * - `false`: force-hide control icons on this field/group regardless of role config
     * Falls back to `show_icons` if not set.
     */
    show_control_icons?: boolean;
    /**
     * Whether to show the edit element control (pencil icon) for this field/group.
     *
     * When true and `control_edit_elements` is visible in `icons_behaviour`:
     * - **Field level**: Shows pencil icon that opens edit field dialog with integrated delete
     * - **Group level**: Shows pencil icon that opens edit group dialog with integrated delete
     *
     * This provides a unified edit experience with delete functionality inside the edit dialog,
     * replacing the need for a separate delete control.
     *
     * @default false
     */
    show_edit_element_control?: boolean;
    /**
     * Prompt area identifier for LLM context (e.g., 'tax_deductions').
     * Sent to the autofill API to help the LLM understand the domain.
     * Required when accept_public_files='ai_upload'.
     */
    prompt_area?: string;
    /**
     * Prompt key identifier for LLM context (e.g., 'd1_car_expenses').
     * Sent to the autofill API to help the LLM understand the specific group.
     * Required when accept_public_files='ai_upload'.
     */
    prompt_key?: string;
    /** Currency symbol for currency fields (default: '$') */
    currency_symbol?: string;
    /** Number of decimal places for numeric formatting */
    decimal_places?: number;
    /** Whether field displays as percentage */
    is_percentage?: boolean;
    /** Formula for computed fields */
    computed_formula?: string;
    /** Field IDs this computed field depends on */
    computed_dependencies?: string[];
    /** Static content for display-only fields */
    static_content?: string;
    /** Style variant for hierarchical styling (e.g., 'total_h1') */
    style_variant?: import('../types/style_variant.js').StyleVariant;
    /** Item code box prefix (e.g., '1', '10') */
    item_code?: string;
    /** Badge letter/text (e.g., 'J', 'M') */
    badge?: string;
    /** Note displayed next to summary row label */
    summary_note?: string;
    /** Display format with X/# placeholders for masked input (e.g., 'XXX XXX XXX') */
    display_format?: string;
    /** Masked input type hint (e.g., 'tfn', 'abn') */
    masked_type?: string;
    /** Wrap this field in a collapsible accordion */
    accordion?: boolean;
    /** Accordion starts open (default: false — starts collapsed) */
    accordion_default_open?: boolean;
    /**
     * IDs of validation rules that apply to this field or group.
     * Rules are defined in the validation rule editor and referenced here by their slug ID.
     * @example ['check_payg_coverage', 'verify_abn_format']
     */
    validation_rules?: string[];
    /**
     * Override for file upload accordion default open state.
     * When true, file accordion starts open even with no files.
     * Cascade: field > group > section > form-level prop
     */
    default_file_accordion_open?: boolean;
    /**
     * Extra CSS classes applied to the outermost `cls_collab_field_container` wrapper div.
     * Use Tailwind utility classes (e.g. `'[grid-column-start:1]'`) to force grid
     * positioning when field_columns > 1.  Has no effect in single-column mode.
     */
    container_class_name?: string;
    /**
     * When true, removes the default `border border-input rounded-md p-4` wrapper
     * around the field grid inside a group. Only applies when field_type='group'.
     */
    disable_border?: boolean;
}
/**
 * Data OK state type for multi-state mode
 */
export type DataOkState = 'ok' | 'not_ok' | 'pending';
/**
 * Represents a change to field metadata
 * Used by the unified on_field_metadata_change callback
 * (Flat shape — public API. FieldMetadataInput and normalize_field_metadata_input
 *  are re-exported from shared/field_state above.)
 */
export interface FieldMetadataChange {
    /**
     * The field ID that changed
     * For additional entries, format is: `original_id:index`
     */
    field_id: string;
    /**
     * New visibility state (if changed)
     */
    visibility?: 'visible' | 'hidden';
    /**
     * New lock state (if changed)
     */
    locked?: boolean;
    /**
     * New data OK state (if changed)
     */
    data_ok?: boolean | DataOkState;
    /**
     * New deleted state (if changed)
     */
    deleted?: boolean;
    /**
     * New skipped/N/A state (if changed)
     */
    skipped?: boolean;
    /**
     * New confirm state (if changed)
     */
    confirm_state?: ConfirmState;
}
/**
 * Section configuration - represents a sidebar item in the form
 *
 * A section contains groups, and each group contains fields.
 * Hierarchy: Section → Groups → Fields
 */
export interface Section {
    /**
     * Name of the section (displayed in sidebar)
     */
    section_name?: string;
    /**
     * Public file accept mode at the section level
     */
    accept_public_files?: FileAcceptMode;
    /**
     * Private file accept mode at the section level
     */
    accept_private_files?: FileAcceptMode;
    /** @deprecated Use accept_public_files instead */
    accept_files_public?: boolean;
    /** @deprecated Use accept_private_files instead */
    accept_files_private?: boolean;
    /**
     * Array of groups in the section
     * Each group is a FieldConfig with field_type='group' and contains fields
     */
    groups?: FieldConfig[];
    /**
     * Icons behaviour configuration for role-based control display
     * Defines which icons are shown, their order, and role-specific visibility/enabled states
     */
    icons_behaviour?: IconsBehaviour;
    /**
     * Override for file upload accordion default open state at section level.
     * Cascade: field > group > section > form-level prop
     */
    default_file_accordion_open?: boolean;
}
/**
 * Helper function to get the name from a Section
 */
export declare function get_section_name(section: Section): string;
/**
 * Helper function to get the groups from a Section
 */
export declare function get_section_groups(section: Section): FieldConfig[];
/**
 * Helper function to get the fields from a group (FieldConfig with field_type='group')
 */
export declare function get_group_fields(group: FieldConfig): FieldConfig[];
/**
 * Props for the HazoCollabFormSet component
 */
export interface HazoCollabFormSetProps {
    /**
     * Section configuration (JSON structure)
     * Contains section_name and groups array
     */
    section: Section;
    /**
     * Chat group ID for hazo_chat v3.0.0+ (group-based chat)
     */
    chat_group_id?: string;
    /**
     * Chat read-only mode (v4.0.4+)
     * When true, chat input is hidden for view-only mode across all fields
     * Individual fields can override this with their own chat_read_only setting
     */
    chat_read_only?: boolean;
    /**
     * Chat hide references
     * When true, hides the references section in chat
     */
    chat_hide_references?: boolean;
    /**
     * Chat hide sidebar
     * When true, hides the entire document viewer sidebar (v5.2.0+)
     */
    chat_hide_sidebar?: boolean;
    /**
     * Chat hide preview
     * When true, hides message preview/attachment preview in chat
     */
    chat_hide_preview?: boolean;
    /**
     * Chat display mode - controls how chat is rendered
     * - 'embedded': Default embedded mode
     * - 'side_panel': Renders as a side panel
     * - 'overlay': Renders as an overlay
     */
    chat_display_mode?: 'embedded' | 'side_panel' | 'overlay';
    /**
     * Chat container element for portal rendering
     * Used with certain display modes to control where chat is rendered
     */
    chat_container_element?: HTMLElement | null;
    /**
     * Chat log polling
     * When true, logs polling activity to console (default: false)
     * Use this to debug polling issues or suppress console logs in production
     */
    chat_log_polling?: boolean;
    /**
     * Optional callback when a field value changes
     */
    on_field_change?: (field_id: string, value: any) => void;
    /**
     * Optional callback when form data changes (all fields)
     */
    on_form_data_change?: (form_data: Record<string, any>) => void;
    /**
     * Initial form data (optional, for controlled component)
     */
    initial_data?: Record<string, any>;
    /**
     * Enable notes for all fields in the form set
     * When true, all fields will have the notes icon enabled
     * Individual fields can still override this with their own enable_notes setting
     */
    enable_notes?: boolean;
    /**
     * Enable chat for all fields in the form set
     * When true, all fields will have the chat icon enabled
     * Individual fields can still override this with their own enable_chat setting
     * Default: true (for backward compatibility)
     */
    enable_chat?: boolean;
    /**
     * Enable data OK controls for all fields in the form set
     * When true, all fields will show the data OK checkbox/selector
     * Individual fields can still override this with their own enable_data_ok setting
     * Default: true (for backward compatibility)
     */
    enable_data_ok?: boolean;
    /**
     * Optional callback when notes change for any field
     * Called with field_id and the updated notes array
     * Use this to persist notes to your backend
     */
    on_notes_change?: (field_id: string, notes: NoteEntry[]) => void;
    /**
     * Optional callback when all notes data changes
     * Called with a map of field_id -> notes array
     * Use this to get all notes when any field's notes change
     */
    on_all_notes_change?: (all_notes: Record<string, NoteEntry[]>) => void;
    /**
     * Notes panel presentation style for all fields
     * - 'popover': Compact popup near the icon (default)
     * - 'slide_panel': Full-height panel that slides in from the right
     */
    notes_panel_style?: 'popover' | 'slide_panel';
    /**
     * Notes panel background color for all fields (Tailwind class)
     * Example: 'bg-yellow-100', 'bg-blue-50'
     */
    notes_background_color?: string;
    /**
     * Notes save behavior for all fields
     * - 'explicit': User clicks Save/Cancel buttons (default)
     * - 'auto': Note saved automatically when panel closes or on blur
     */
    notes_save_mode?: 'explicit' | 'auto';
    /**
     * Notes management mode for all fields
     * - 'controlled': (default for backward compatibility) Notes state managed by this component.
     *   Use on_notes_change/on_all_notes_change callbacks to persist notes.
     * - 'api': Notes managed by hazo_notes package via API.
     *   No notes state in this component - HazoNotesIcon fetches/persists via hazo_notes API.
     *   Requires hazo_notes API routes to be set up in your app.
     */
    notes_mode?: 'controlled' | 'api';
    /**
     * Chat realtime mode for hazo_chat polling behavior
     * - 'polling': (default) Automatically poll for new messages every 5 seconds
     * - 'manual': Disable automatic polling, useful when using websockets or manual refresh
     */
    chat_realtime_mode?: 'polling' | 'manual';
    /**
     * Skip internal chat status checking.
     * Set to true when the parent component (e.g. HazoCollabFormView) already manages
     * chat status via use_field_chat_status, to avoid duplicate API requests.
     */
    skip_internal_chat_check?: boolean;
    /**
     * Whether the data OK checkbox is editable (clickable) for all fields
     * When false, the checkbox is disabled (read-only).
     * Individual fields can override this with their own data_ok_editable setting.
     * Default: false
     */
    data_ok_editable?: boolean;
    /**
     * Data OK display mode for all fields
     * - 'checkbox': Binary checkbox (OK/Not OK) - default, backward compatible
     * - 'multi_state': Three-state selector (OK/Not OK/Pending) with click-cycle and dropdown
     * Individual fields can override this with their own data_ok_mode setting.
     */
    data_ok_mode?: 'checkbox' | 'multi_state';
    /**
     * Default value for the data OK for all fields
     * - boolean: For checkbox mode (true = checked, false = unchecked)
     * - 'ok' | 'not_ok' | 'pending': For multi_state mode
     * Individual fields can override this with their own data_ok_default setting.
     * Default: false for checkbox mode, 'pending' for multi_state mode
     */
    data_ok_default?: boolean | 'ok' | 'not_ok' | 'pending';
    /**
     * States to hide from user selection across all data_ok controls.
     * Hidden states will still display if current value matches,
     * but cannot be selected via click-cycle or dropdown.
     * Individual fields can override with their own data_ok_hidden_states.
     * @example ['pending'] - Users can only select 'ok' or 'not_ok'
     */
    data_ok_hidden_states?: DataOkState[];
    /**
     * Enable visibility toggle for all fields in the form set
     * When true, all fields will have the visibility toggle enabled
     * Individual fields can still override this with their own enable_visibility_toggle setting
     */
    enable_visibility_toggle?: boolean;
    /**
     * Default visibility state for all fields
     * - 'visible': Fields are visible to all users (default)
     * - 'hidden': Fields start hidden from responders
     * Individual fields can override this with their own visibility setting
     */
    visibility_default?: 'visible' | 'hidden';
    /**
     * User role for visibility and authoring features
     * - 'author': Can see and toggle visibility of hidden fields, can delete/lock fields
     * - 'responder': Cannot see hidden fields, cannot use author features
     * Default: 'responder'
     */
    user_role?: 'author' | 'responder';
    /**
     * Callback when visibility changes for any field
     * Called with field_id and the new visibility state
     */
    on_visibility_change?: (field_id: string, visibility: 'visible' | 'hidden') => void;
    /**
     * Enable delete for all fields in the form set
     * When true, all fields will have the delete icon enabled
     * Individual fields can still override this with their own enable_delete setting
     */
    enable_delete?: boolean;
    /**
     * Callback when a field is deleted
     * Called with field_id
     */
    on_delete?: (field_id: string) => void;
    /**
     * Callback when a field is restored (undo delete)
     * Called with field_id
     */
    on_restore?: (field_id: string) => void;
    /**
     * Enable lock for all fields in the form set
     * When true, all fields will have the lock icon enabled
     * Individual fields can still override this with their own enable_lock setting
     */
    enable_lock?: boolean;
    /**
     * Default lock state for all fields
     * When true, fields start locked (read-only)
     * Individual fields can override this with their own locked setting
     */
    locked_default?: boolean;
    /**
     * Callback when lock state changes for any field
     * Called with field_id and the new lock state
     */
    on_lock_change?: (field_id: string, locked: boolean) => void;
    /**
     * Enable skip/N/A for all fields in the form set
     * When true, all fields will have the N/A (Not Applicable) icon enabled
     * Individual fields can still override this with their own enable_skip setting
     */
    enable_skip?: boolean;
    /**
     * Default skip state for all fields
     * When true, fields start marked as N/A (skipped)
     * Individual fields can override this with their own skipped setting
     */
    skipped_default?: boolean;
    /**
     * Callback when skip state changes for any field
     * Called with field_id and the new skip state
     */
    on_skip_change?: (field_id: string, skipped: boolean) => void;
    /**
     * Callback when data OK state changes for any field
     * Called with field_id and the new data OK value (boolean for checkbox, DataOkState for multi-state)
     * This provides a dedicated callback for data_ok changes (in addition to on_field_metadata_change)
     */
    on_data_ok_change?: (field_id: string, value: boolean | DataOkState) => void;
    /**
     * Display mode for edit action icons across all fields
     * - 'auto': Show single icon when only one action enabled, dropdown when multiple (default)
     * - 'separate': Always show individual icons side by side
     * - 'dropdown': Always show consolidated 3-dots dropdown menu
     * Individual fields can override with their own edit_actions_display setting
     */
    edit_actions_display?: 'auto' | 'separate' | 'dropdown';
    /**
     * Include chat icon in the consolidated 3-dots dropdown menu for all fields
     * When true, chat icons move into the edit actions dropdown across all fields
     * Individual fields can override with their own include_chat_in_dropdown setting
     * Default: false (chat icons show separately)
     */
    include_chat_in_dropdown?: boolean;
    /**
     * Include notes icon in the consolidated 3-dots dropdown menu for all fields
     * When true, notes icons move into the edit actions dropdown across all fields
     * Individual fields can override with their own include_notes_in_dropdown setting
     * Default: false (notes icons show separately)
     */
    include_notes_in_dropdown?: boolean;
    /**
     * Extract chat icon from dropdown when it has messages
     * Only applies when include_chat_in_dropdown=true
     * When true and a field has chat messages, chat icon shows separately (extracted)
     * Individual fields can override with their own extract_active_chat setting
     * Default: false
     */
    extract_active_chat?: boolean;
    /**
     * Extract notes icon from dropdown when notes exist
     * Only applies when include_notes_in_dropdown=true
     * When true and a field has notes, notes icon shows separately (extracted)
     * Individual fields can override with their own extract_active_notes setting
     * Default: false
     */
    extract_active_notes?: boolean;
    /**
     * Remove borders from all action buttons
     * When true, action icons (data OK, chat, notes, lock, visibility, delete, etc.)
     * will render without borders for a cleaner appearance
     * Default: false (buttons have borders)
     */
    action_buttons_borderless?: boolean;
    /**
     * Custom colors for the chat status icon.
     * If not provided, colors are loaded from config file or defaults are used.
     * Use Tailwind CSS class names for all values.
     *
     * @example
     * ```typescript
     * chat_status_colors={{
     *   icon_color_unread: 'text-red-500',
     *   icon_bg_unread: 'bg-red-100',
     *   icon_border_unread: 'border-red-500',
     *   icon_color_has_messages: 'text-amber-500',
     *   icon_bg_has_messages: 'bg-amber-100',
     *   icon_border_has_messages: 'border-amber-400',
     * }}
     * ```
     */
    chat_status_colors?: ChatStatusColorsConfig;
    /**
     * External field metadata for controlled sync.
     * When provided, the component syncs its internal state (visibility, locked, deleted)
     * with the values in this map.
     *
     * This enables parent components to control field metadata without remounting,
     * solving the sync problem when metadata changes externally (e.g., in a summary view).
     *
     * Only fields present in this map are synced; other fields retain their state.
     * Supports both naming conventions (visibility/hidden, data_ok/dataOk).
     *
     * @example
     * ```typescript
     * <HazoCollabFormSet
     *   fields_set={fields}
     *   field_metadata={{
     *     tax_file_number: { visibility: 'hidden', locked: true },
     *     name: { visibility: 'visible', locked: false }
     *   }}
     *   on_field_metadata_change={handleMetadataChange}
     * />
     * ```
     */
    field_metadata?: Record<string, FieldMetadataInput>;
    /**
     * Unified callback for any field metadata change.
     * Called with the field ID and all changed metadata properties.
     *
     * This is called IN ADDITION to the specific callbacks (on_visibility_change,
     * on_lock_change, on_delete), providing a single handler for all metadata changes.
     *
     * Useful for:
     * - Simplified state management in parent components
     * - Batch updates to backend
     * - Unified logging/tracking
     *
     * @example
     * ```typescript
     * on_field_metadata_change={(change) => {
     *   setFieldMetadata(prev => ({
     *     ...prev,
     *     [change.field_id]: {
     *       ...prev[change.field_id],
     *       ...change
     *     }
     *   }));
     * }}
     * ```
     */
    on_field_metadata_change?: (change: FieldMetadataChange) => void;
    /**
     * When true, fields with confirm_state === 'prefilled' render an inline Check button.
     * Clicking it fires on_field_metadata_change({ field_id, confirm_state: 'confirmed' }).
     * Form-level only — no per-field override. Defaults to false.
     */
    show_confirm_action?: boolean;
    /**
     * Icons behaviour configuration for role-based control display.
     * Defines which icons are shown, their order, border settings, and role-specific visibility/enabled states.
     * Takes precedence over section.icons_behaviour if provided.
     * Use this when icons_behaviour is stored at the root JSON level rather than inside each section.
     */
    icons_behaviour?: IconsBehaviour;
    /**
     * Active role ID for icons_behaviour-based control visibility and editability.
     * Must match a role_id defined in icons_behaviour.roles or section.icons_behaviour.roles
     * When provided, the role's control settings override individual enable_* and *_editable props.
     * @example 'tax_agent_new', 'client_entering_data'
     */
    active_role?: string;
    /**
     * Current user info for notes (used to display author info when creating notes)
     * If not provided, hazo_notes will attempt to fetch user from hazo_auth API.
     */
    current_user?: {
        id?: string;
        name: string;
        email: string;
        profile_image?: string;
    };
    /**
     * Callback when a new field is added via the "+" control
     * Called with the field_id after which to insert and the new field definition
     */
    on_add_field?: (after_field_id: string, new_field: NewFieldDefinition) => void;
    /**
     * Callback when a new field is added via the "+" control
     * Called with the field_id after which to insert and a ready-to-use FieldConfig
     * The FieldConfig includes an auto-generated ID and all properties mapped from NewFieldDefinition
     *
     * If both on_add_field and on_add_field_config are provided, both will be called.
     * Use this callback when you want a ready-to-use configuration without manual conversion.
     */
    on_add_field_config?: (after_field_id: string, field_config: FieldConfig) => void;
    /**
     * Callback when a new group is added at section level
     * Called with the position indicator (before_first_group or after_group_id) and the group config
     * The group_config has field_type='group' and includes child fields in its 'fields' array
     *
     * Use this callback when you need to add groups to section.groups (not inside existing groups).
     * The position_id format is:
     * - "before_<first_group_id>" when clicking the first "+" bar
     * - "<group_id>" when clicking after an existing group
     */
    on_add_group_config?: (position_id: string, group_config: FieldConfig) => void;
    /**
     * Callback when the edit field icon is clicked
     * Called with the field_id and current field configuration
     * Use this to open an edit dialog and update the field structure
     */
    on_edit_field_config?: (field_id: string, current_config: FieldConfig) => void;
    /**
     * Callback when the delete field icon is clicked
     * Called with the field_id to remove from the form structure
     * This is for hard delete (removing from sections), not soft delete (metadata flag)
     */
    on_delete_field?: (field_id: string) => void;
    /**
     * Callback when the re-validate icon is clicked
     * Called with the field_id and its validation_rule_ids
     */
    on_revalidate?: (field_id: string, validation_rule_ids: string[]) => void;
    /**
     * Optional shadcn/ui Dialog components
     * Pass your app's Dialog, DialogContent, DialogHeader, etc. for Add Field dialog
     */
    dialog_components?: DialogComponents;
    /**
     * Optional shadcn/ui Popover and Command components for field type combobox
     * Pass your app's Popover, Command, etc. for the field type selector in Add Field dialog
     */
    combobox_components?: ComboboxComponents;
    /**
     * Enable Library/Custom tabs in Add Field and Add Group dialogs
     * @default true
     */
    enable_library?: boolean;
    /**
     * API endpoint for the field library
     * @default '/api/hazo_connect/sqlite/data'
     */
    library_api_base_url?: string;
    /**
     * Database table name for the field library
     * @default 'hazo_collab_form_elts'
     */
    library_table_name?: string;
    /**
     * Scope ID for filtering library elements
     */
    library_scope_id?: string | null;
    /**
     * Whether the current user/role can access private files
     * When true, private file sections are visible for fields with accept_private_files='basic_upload'.
     * This is typically resolved from the active_role's can_access_private_files setting
     * in icons_behaviour/global_settings and passed down from HazoCollabFormView.
     *
     * Priority (highest to lowest):
     * 1. This form-level prop (overrides field-level and hazo_auth)
     * 2. Field-level can_access_private_files prop
     * 3. hazo_auth API permission check (using private_files_permission)
     */
    can_access_private_files?: boolean;
    /**
     * File manager configuration for hazo_files integration.
     * When provided, file upload/remove operations use the callback interface
     * instead of the legacy upload_endpoint pattern.
     */
    file_manager?: FileManagerConfig;
    /**
     * Callback when files change for any field.
     * Called with field_id and the updated files array.
     *
     * Files are automatically stored in form_data using key pattern `__files_${field_id}`
     * and will be included in get_form_data() and on_form_data_change callbacks.
     */
    on_field_files_change?: (field_id: string, files: FormFileAttachment[]) => void;
    /**
     * Callback when private files change for any field.
     * Called with field_id and the updated private files array.
     *
     * Private files are automatically stored in form_data using key pattern `__private_files_${field_id}`
     * and will be included in get_form_data() and on_form_data_change callbacks.
     */
    on_field_private_files_change?: (field_id: string, files: FormFileAttachment[]) => void;
    /**
     * Function to get row background color for a field based on its data_ok state
     * Returns a Tailwind CSS class for the field's background color
     * Used for data_ok-based row highlighting in edit view
     */
    get_row_color?: (field_id: string) => string;
    /**
     * Reference data to display below form fields
     * Keyed by field ID, each entry shows a reference value with optional label
     * Example use case: displaying prior year tax values for comparison
     * Note: Field-level reference props (reference_value, reference_label) take precedence over this
     */
    reference_data?: Record<string, {
        id?: string;
        value: string | number | boolean | Record<string, unknown>[];
        label?: string;
        tax_year?: number;
        background_color?: string;
    } | Array<{
        id?: string;
        value: string | number | boolean | Record<string, unknown>[];
        label?: string;
        tax_year?: number;
        background_color?: string;
    }>>;
    /** Callback when a reference entry is deleted */
    on_reference_delete?: (field_id: string, index: number, reference_id?: string) => void;
    /**
     * Consumer-provided API endpoint for LLM-based autofill extraction.
     * When provided along with `accept_public_files: 'ai_upload'` on a group,
     * a dropzone is rendered at the top of the group.
     * The endpoint receives a POST with AutofillRequest body and should return AutofillResponse.
     */
    autofill_api_endpoint?: string;
    /**
     * External upload manager for background multi-file uploads.
     * When provided, the dropzone operates in manager-mode: files are queued
     * and processed asynchronously rather than blocking the UI.
     */
    upload_manager?: ExternalUploadManager;
    /**
     * Called when an autofill extraction completes successfully.
     * Receives the file_id of the uploaded source document.
     * Used by the parent (e.g. EditView) to emit audit intent events.
     */
    on_autofill_applied?: (file_id: string) => void;
    /** Styles configuration for financial field rendering (summary_row style_variant) */
    styles_config?: import('../types/style_variant.js').StylesConfig;
    /** Field types configuration for custom field types */
    field_types_config?: import('../types/field_type_definition.js').FieldTypesConfig;
    /** Callbacks for clarification lifecycle (respond, resolve, dismiss, reopen) */
    clarification_callbacks?: import('../types/clarification.js').ClarificationCallbacks;
    /**
     * Controls how clarifications are displayed.
     * - 'both' (default): Show badges on fields AND inline section
     * - 'badge_only': Show only badges on fields
     * - 'section_only': Show only the inline section (no badges on fields)
     * @default 'both'
     */
    clarification_display?: 'both' | 'badge_only' | 'section_only';
    /**
     * Default open state for file upload accordions.
     * When true, file accordions start open even when no files exist.
     * Cascade: field > group > section > this prop
     */
    default_file_accordion_open?: boolean;
}
/**
 * Exposed methods for HazoCollabFormSet
 */
export interface HazoCollabFormSetRef {
    /**
     * Get all form data
     */
    get_form_data: () => Record<string, any>;
    /**
     * Set form data
     */
    set_form_data: (data: Record<string, any>) => void;
    /**
     * Reset form to initial values
     */
    reset_form: () => void;
    /**
     * Get all notes data
     * Returns a map of field_id -> notes array
     */
    get_notes_data: () => Record<string, NoteEntry[]>;
    /**
     * Get all files data
     * Returns a map of field_id -> files array
     * Extracts files from form_data entries with __files_ prefix
     */
    get_files_data: () => Record<string, FormFileAttachment[]>;
    /**
     * Get all private files data
     * Returns a map of field_id -> files array
     * Extracts files from form_data entries with __private_files_ prefix
     */
    get_private_files_data: () => Record<string, FormFileAttachment[]>;
}
/**
 * Collaboration form set component
 * Dynamically generates forms from JSON configuration
 *
 * @deprecated Use HazoCollabFormView with mode="edit" instead.
 * @example
 * // BEFORE (deprecated):
 * <HazoCollabFormSet sections={sections} form_data={data} ... />
 *
 * // AFTER (recommended):
 * <HazoCollabFormView mode="edit" sections={sections} form_data={data} ... />
 */
export declare const HazoCollabFormSet: React.ForwardRefExoticComponent<HazoCollabFormSetProps & React.RefAttributes<HazoCollabFormSetRef>>;
//# sourceMappingURL=_internal_form_set.d.ts.map