import { CardElement } from '../definitions/elements';
import { DisplayCard } from '../definitions/cards';
import { ConditionParamV1 } from '../definitions/shared/conditions';
import { v1ConditionParamsToV2 } from './conditionMap';
/** Per-conversion map of snippet instance id → raw override values. */
type SnippetOverrides = Record<string, Record<string, unknown>>;
/** Test-only: reset the id counter so generated ids are deterministic. */
export declare function __resetIdCounter(): void;
/**
 * v1 page-level config shape (loose — the adapter only inspects keys it
 * needs to translate, everything else passes through).
 */
export interface V1PageConfig {
    title?: string;
    breadCrumbs?: {
        title: string;
    }[];
    section?: string;
    tabsList?: V1TabConfig[];
    cards?: V1CardConfig[];
    headers?: unknown;
    options?: Record<string, unknown>;
    listKey?: string;
    createConfig?: unknown;
    updateConfig?: unknown;
    deleteConfig?: unknown;
    eventHandlers?: Record<string, (...args: unknown[]) => unknown>;
    [key: string]: unknown;
}
export interface V1TabConfig {
    title?: string;
    tabId?: string;
    cards?: V1CardConfig[];
    nextTab?: {
        id: string;
        text: string;
    };
    [key: string]: unknown;
}
export interface V1CardConfig {
    type: string;
    title?: string;
    subtitle?: string;
    showCard?: boolean;
    fieldsList?: V1FieldConfig[];
    cards?: V1CardConfig[];
    tabsList?: V1TabConfig[];
    buttons?: V1FieldConfig[];
    headers?: unknown;
    options?: Record<string, unknown>;
    listKey?: string;
    cols?: number;
    colsSm?: number;
    colsMd?: number;
    colsLg?: number;
    colsXl?: number;
    classList?: string[] | string;
    conditionParams?: ConditionParamV1[];
    [key: string]: unknown;
}
export interface V1FieldConfig {
    type: string;
    name?: string;
    label?: string;
    default?: unknown;
    defaultValue?: unknown;
    options?: unknown;
    cols?: number;
    colsSm?: number;
    colsMd?: number;
    colsLg?: number;
    colsXl?: number;
    conditionParams?: ConditionParamV1[];
    [key: string]: unknown;
}
/**
 * The v2 page shape consumers pass to ShowPage / IndexPage. Cards and
 * elements are kept in flat id-keyed maps so cards can reference each
 * other (and their elements) by id.
 */
export interface V2PageConfig {
    title?: string;
    breadCrumbs?: {
        title: string;
    }[];
    section?: string;
    tabsList?: {
        title: string;
        tabId: string;
        cards: DisplayCard[];
    }[];
    cards: Record<string, DisplayCard>;
    elements: Record<string, CardElement>;
    /** Per-placement snippet override values, keyed by instance id. */
    snippetOverrides?: Record<string, Record<string, unknown>>;
    createConfig?: unknown;
    updateConfig?: unknown;
    deleteConfig?: unknown;
    eventHandlers?: Record<string, (...args: unknown[]) => unknown>;
    [key: string]: unknown;
}
/**
 * Convert a v1 page config (IndexPage or ShowPage) to the v2 shape.
 */
export declare function v1ToV2(config: V1PageConfig): V2PageConfig;
declare function convertCard(v1: V1CardConfig, cards: Record<string, DisplayCard>, elements: Record<string, CardElement>, seen?: Set<string>, snippetOverrides?: SnippetOverrides): DisplayCard;
declare function convertElement(v1: V1FieldConfig, seen?: Set<string>): CardElement;
declare function normaliseOptions(input: unknown): unknown;
/** A self-contained set of converted v2 cards + the elements they reference. */
export interface V2CardBundle {
    /** Flat id-keyed card map (top-level + nested cards). */
    cards: Record<string, DisplayCard>;
    /** Flat id-keyed element map referenced by the cards. */
    elements: Record<string, CardElement>;
    /** Ids of the top-level cards within `cards`, in input order. */
    ids: string[];
    /** Per-placement snippet override values, keyed by instance id. */
    snippetOverrides: Record<string, Record<string, unknown>>;
}
/**
 * A self-contained v2 builder schema for a set of tabs: a `tab-list` root
 * card whose `tabList` references one tab card per input tab, plus the flat
 * card/element maps. This is exactly the shape the FormBuilder consumes in
 * `rootTabsContainer` mode.
 */
export interface V2TabsBundle {
    /** Id of the root `tab-list` card within `cards`. */
    rootCardId: string;
    cards: Record<string, DisplayCard>;
    elements: Record<string, CardElement>;
    /** Per-placement snippet override values, keyed by instance id. */
    snippetOverrides: Record<string, Record<string, unknown>>;
}
/** Convert a single v1 field into a v2 element. */
export declare function v1ElementToV2(field: V1FieldConfig): CardElement;
/**
 * Convert v1 fields into v2 elements. Accepts an array or a single field
 * (a single value is treated as a one-element list).
 */
export declare function v1ElementsToV2(fields: V1FieldConfig | V1FieldConfig[]): CardElement[];
/**
 * Convert v1 cards (+ descendants) into a self-contained bundle. Accepts an
 * array or a single card (a single value is treated as a one-element list).
 * All produced card/element ids are guaranteed unique.
 */
export declare function v1CardsToV2(v1Cards: V1CardConfig | V1CardConfig[]): V2CardBundle;
/** Convert a single v1 card (+ descendants) into a self-contained bundle. */
export declare function v1CardToV2(v1Card: V1CardConfig): V2CardBundle;
/**
 * Convert v1 tabs into a self-contained tabs bundle. Accepts an array or a
 * single tab (a single value is treated as a one-element list).
 *
 * A tab body can be expressed two ways and both are supported:
 *   - `tab.cards` — nested v1 cards (the classic tabs_list shape), or
 *   - `tab.fieldsList` / `tab.elementList` — a flat field list directly on
 *     the tab (an "element-list" tab, e.g. the FormBuilder rootTabsContainer
 *     shape). These are wrapped into a synthesized `fields_list` card so the
 *     fields aren't dropped.
 */
export declare function v1TabsToV2(v1Tabs: V1TabConfig | V1TabConfig[], options?: {
    rootKey?: string;
}): V2TabsBundle;
/**
 * Convert a single v1 tab into a self-contained tabs bundle (a tab-list root
 * with one tab card).
 */
export declare function v1TabToV2(v1Tab: V1TabConfig, options?: {
    rootKey?: string;
}): V2TabsBundle;
export declare const __testing: {
    convertCard: typeof convertCard;
    convertElement: typeof convertElement;
    normaliseOptions: typeof normaliseOptions;
    v1ConditionParamsToV2: typeof v1ConditionParamsToV2;
};
export { v1ConditionParamsToV2 };
//# sourceMappingURL=v1ToV2.d.ts.map