import { ComponentType, ReactNode } from "react";
import { EditContextType } from "../../editor/client/editContext";
/**
 * Panel represents a single panel within a sidebar.
 * A sidebar can have multiple panels stacked vertically.
 */
export type SidebarPanel = {
    /** Unique name for this panel within the sidebar */
    name: string;
    /** Display title shown in the panel header */
    title: string;
    /** Optional icon shown in the panel header */
    icon?: ReactNode;
    /** Whether to omit the header icon even when the sidebar has one */
    hideHeaderIcon?: boolean;
    /** Panel content component */
    content: ReactNode;
    /** Initial size as percentage (used when multiple panels) */
    initialSize?: number;
    /** Custom header component */
    header?: ComponentType<{
        panel: SidebarPanel;
        index: number;
    }>;
    /** Whether to disable overflow scrolling */
    noOverflow?: boolean;
    /** Whether the panel content renders its own header chrome */
    hideHeader?: boolean;
};
/**
 * PanelFactory creates a panel dynamically based on context.
 */
export type SidebarPanelFactory = (editContext: EditContextType) => SidebarPanel;
/**
 * SidebarDefinition represents a panel that can be opened within the Editor workspace.
 *
 * Sidebars are the panels that appear on the left or right of the main editing area:
 * - History, Comments, Reviews, Validation (left)
 * - Component Navigator, Agents Panel (right)
 *
 * Users can open multiple sidebars, pin them, and arrange them.
 */
export type SidebarDefinition = {
    /** Unique identifier for this sidebar */
    id: string;
    /** Display title shown in the sidebar selector and header */
    title: string;
    /** Icon shown in the sidebar selector */
    icon: ReactNode;
    /** Position of the sidebar relative to the center panel */
    position: "left" | "right";
    /** Panels to display in this sidebar (can have multiple stacked panels) */
    panels: (SidebarPanel | SidebarPanelFactory)[];
    /** Default width in pixels when opened */
    defaultWidth?: number;
    /**
     * Whether this sidebar can be pinned.
     * Pinned sidebars stay open even when switching items.
     * @default true
     */
    pinnable?: boolean;
    /**
     * Whether multiple sidebars can be open simultaneously on the same side.
     * @default true
     */
    allowMultiple?: boolean;
    /**
     * Only show this sidebar when an item is loaded.
     * @default false
     */
    requiresItem?: boolean;
    /**
     * Only show this sidebar for items with layout (page items).
     * @default false
     */
    requiresLayout?: boolean;
    /**
     * Whether this sidebar should be hidden from the sidebar selector.
     * @default false
     */
    hidden?: boolean;
    /**
     * Dynamic visibility function.
     * If provided, sidebar is only shown when this returns true.
     */
    visible?: (editContext: EditContextType) => boolean;
    /**
     * Sort order for display in the sidebar selector.
     * Lower numbers appear first.
     * @default 100
     */
    sortOrder?: number;
};
/**
 * Resolved sidebar with all panels materialized (no factories).
 */
export type ResolvedSidebar = Omit<SidebarDefinition, "panels"> & {
    panels: SidebarPanel[];
};
