import { ZodObject, ZodSchema } from 'zod';
import { ReactNode, ComponentType } from 'react';
import { F as FieldConfigItem } from './stack.8nldKomx.js';

type PropValue = ReactNode | VariableReference | Record<string, any> | any[] | string | number | boolean | null | undefined;
type ComponentProps<TProps extends Record<string, PropValue> = Record<string, PropValue>> = TProps;
interface ComponentLayer<TProps extends Record<string, PropValue> = Record<string, PropValue>> {
    id: string;
    name?: string;
    type: string;
    props: ComponentProps<TProps>;
    children: ComponentLayer[] | string | VariableReference;
}
type VariableValueType = 'string' | 'number' | 'boolean';
type VariableValue<T extends VariableValueType> = T extends 'string' ? string : T extends 'number' ? number : T extends 'boolean' ? boolean : never;
interface Variable<T extends VariableValueType = VariableValueType> {
    id: string;
    name: string;
    type: T;
    defaultValue: VariableValue<T>;
}
interface VariableReference {
    __variableRef: string;
}
interface DefaultVariableBinding {
    propName: string;
    variableId: string;
    immutable?: boolean;
}
interface RegistryEntry<T extends ComponentType<any>> {
    component?: T;
    schema: ZodObject<any> | ZodSchema<any>;
    from?: string;
    isFromDefaultExport?: boolean;
    defaultChildren?: ComponentLayer[] | string | VariableReference;
    defaultVariableBindings?: DefaultVariableBinding[];
    fieldOverrides?: Record<string, FieldConfigFunction>;
    /**
     * If defined, this component can only be added as a child of the specified parent types.
     * Used to filter component options in the add popover and validate drag-and-drop.
     * Example: TabsTrigger has childOf: ["TabsList"]
     */
    childOf?: string[];
}
type FieldConfigFunction = (layer: ComponentLayer, allowVariableBinding?: boolean) => FieldConfigItem;
type ComponentRegistry = Record<string, RegistryEntry<ComponentType<any>>>;

export type { ComponentLayer as C, FieldConfigFunction as F, PropValue as P, RegistryEntry as R, Variable as V, ComponentRegistry as a };
