import { ReactNode } from "react";
import { EditContextType } from "../../editor/client/editContext";
/**
 * ToolbarFactory creates toolbar content for a workspace.
 */
export type ToolbarFactory = (editContext: EditContextType) => ReactNode;
/**
 * WorkspaceDefinition represents a fundamentally different UI experience.
 *
 * Workspaces are distinct application modes like:
 * - Home (splash screen)
 * - Editor (main content editing)
 * - Settings (configuration panels)
 * - Agents (AI agents dashboard)
 *
 * Unlike the old "views" system, workspaces are truly separate UIs,
 * not just the editor with different sidebars open.
 */
export type WorkspaceDefinition = {
    /** Unique identifier for this workspace */
    id: string;
    /** Display title shown in the workspace switcher */
    title: string;
    /** Icon shown in the workspace switcher */
    icon: ReactNode;
    /** Main content component to render */
    component: ReactNode;
    /** Optional toolbar factory - creates toolbar content */
    toolbarFactory?: ToolbarFactory;
    /** Optional titlebar component */
    titlebar?: ReactNode;
    /** Optional menu bar component */
    menuBar?: ReactNode;
    /**
     * Whether this workspace supports sidebars.
     * Only the Editor workspace typically supports sidebars.
     * @default false
     */
    supportsSidebars?: boolean;
    /**
     * IDs of keyboard commands that are active while this workspace is focused.
     * Commands are resolved from `configuration.commands.keyboardCommands`.
     * Quick-switcher style shell-global shortcuts are configured separately.
     */
    keyboardCommandIds?: string[];
    /**
     * Default sidebars to open when entering this workspace.
     * Only applicable if supportsSidebars is true.
     */
    defaultSidebars?: string[];
    /**
     * Whether this workspace should be hidden from the workspace switcher.
     * Useful for transitional workspaces like page-wizard.
     * @default false
     */
    hidden?: boolean;
    /**
     * Whether to hide the left toolbar (workspace switcher + sidebar icons).
     * Useful for immersive workspaces like the Home screen.
     * @default false
     */
    hideToolbar?: boolean;
    /**
     * Dynamic visibility function.
     * If provided, workspace is only shown when this returns true.
     */
    visible?: (editContext: EditContextType) => boolean;
    /**
     * Called before closing/leaving this workspace.
     * Return false to prevent navigation away.
     */
    beforeClose?: (editContext: EditContextType) => Promise<boolean>;
    /**
     * Dynamic header title function.
     * If provided, overrides the static title.
     */
    headerTitle?: (editContext: EditContextType) => string;
    /**
     * Sort order for displaying workspaces in the workspace switcher.
     * Lower numbers appear first. Defaults to 100 if not specified.
     */
    sortOrder?: number;
};
/**
 * Runtime state for a workspace instance.
 */
export type WorkspaceState = {
    /** Current workspace ID */
    workspaceId: string;
    /** Previously active workspace ID (for back navigation) */
    previousWorkspaceId?: string;
    /** Currently open sidebars (if workspace supports them) */
    openSidebars: string[];
    /** Pinned sidebars that persist across item changes */
    pinnedSidebars: string[];
};
