import { z } from 'zod';

// src/studio/plugin.zod.ts
var ViewModeSchema = z.enum(["preview", "design", "code", "data"]);
var MetadataViewerContributionSchema = z.object({
  /** Unique viewer ID (namespaced: `pluginId.viewerId`) */
  id: z.string().describe("Unique viewer identifier"),
  /** Metadata type(s) this viewer handles (e.g., "object", "flow", "agent") */
  metadataTypes: z.array(z.string()).min(1).describe("Metadata types this viewer can handle"),
  /** Human-readable label shown in the view switcher */
  label: z.string().describe("Viewer display label"),
  /** Priority — highest-priority viewer becomes default. Built-in default = 0 */
  priority: z.number().default(0).describe("Viewer priority (higher wins)"),
  /** View modes this viewer supports */
  modes: z.array(ViewModeSchema).default(["preview"]).describe("Supported view modes")
});
var SidebarGroupContributionSchema = z.object({
  /** Unique group key */
  key: z.string().describe("Unique group key"),
  /** Display label */
  label: z.string().describe("Group display label"),
  /** Lucide icon name (e.g., "database", "workflow") */
  icon: z.string().optional().describe("Lucide icon name"),
  /** Metadata types belonging to this group */
  metadataTypes: z.array(z.string()).describe("Metadata types in this group"),
  /** Sort order — lower values appear first */
  order: z.number().default(100).describe("Sort order (lower = higher)")
});
var ActionLocationSchema = z.enum(["toolbar", "contextMenu", "commandPalette"]);
var ActionContributionSchema = z.object({
  /** Unique action ID */
  id: z.string().describe("Unique action identifier"),
  /** Display label */
  label: z.string().describe("Action display label"),
  /** Lucide icon name */
  icon: z.string().optional().describe("Lucide icon name"),
  /** Where this action appears */
  location: ActionLocationSchema.describe("UI location"),
  /** Metadata types this action applies to (empty = all types) */
  metadataTypes: z.array(z.string()).default([]).describe("Applicable metadata types")
});
var MetadataIconContributionSchema = z.object({
  /** Metadata type this icon represents */
  metadataType: z.string().describe("Metadata type"),
  /** Human-readable label */
  label: z.string().describe("Display label"),
  /** Lucide icon name */
  icon: z.string().describe("Lucide icon name")
});
var PanelLocationSchema = z.enum(["bottom", "right", "modal"]);
var PanelContributionSchema = z.object({
  /** Unique panel ID */
  id: z.string().describe("Unique panel identifier"),
  /** Display label */
  label: z.string().describe("Panel display label"),
  /** Lucide icon name */
  icon: z.string().optional().describe("Lucide icon name"),
  /** Panel placement */
  location: PanelLocationSchema.default("bottom").describe("Panel location")
});
var CommandContributionSchema = z.object({
  /** Unique command ID (namespaced: `pluginId.commandName`) */
  id: z.string().describe("Unique command identifier"),
  /** Display label */
  label: z.string().describe("Command display label"),
  /** Keyboard shortcut (e.g., "Ctrl+Shift+P") */
  shortcut: z.string().optional().describe("Keyboard shortcut"),
  /** Lucide icon name */
  icon: z.string().optional().describe("Lucide icon name")
});
var StudioPluginContributionsSchema = z.object({
  /** Metadata viewer/designer components */
  metadataViewers: z.array(MetadataViewerContributionSchema).default([]),
  /** Sidebar navigation groups */
  sidebarGroups: z.array(SidebarGroupContributionSchema).default([]),
  /** Toolbar / context menu / command palette actions */
  actions: z.array(ActionContributionSchema).default([]),
  /** Metadata type icons & labels */
  metadataIcons: z.array(MetadataIconContributionSchema).default([]),
  /** Auxiliary panels */
  panels: z.array(PanelContributionSchema).default([]),
  /** Command palette entries */
  commands: z.array(CommandContributionSchema).default([])
});
var ActivationEventSchema = z.string().describe("Activation event pattern");
var StudioPluginManifestSchema = z.object({
  /** 
   * Unique plugin ID using reverse-domain notation.
   * @example "objectstack.object-designer"
   */
  id: z.string().regex(/^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*$/).describe("Plugin ID (dot-separated lowercase)"),
  /** Human-readable plugin name */
  name: z.string().describe("Plugin display name"),
  /** Semantic version */
  version: z.string().default("0.0.1").describe("Plugin version"),
  /** Plugin description */
  description: z.string().optional().describe("Plugin description"),
  /** Author name */
  author: z.string().optional().describe("Author"),
  /** Declarative contribution points */
  contributes: StudioPluginContributionsSchema.default({
    metadataViewers: [],
    sidebarGroups: [],
    actions: [],
    metadataIcons: [],
    panels: [],
    commands: []
  }),
  /** 
   * Activation events — when to load this plugin.
   * Default `['*']` means eager activation.
   */
  activationEvents: z.array(ActivationEventSchema).default(["*"])
});
function defineStudioPlugin(input) {
  return StudioPluginManifestSchema.parse(input);
}
var FieldPropertySectionSchema = z.object({
  /** Unique section key */
  key: z.string().describe('Section key (e.g., "basics", "constraints", "security")'),
  /** Display label */
  label: z.string().describe("Section display label"),
  /** Lucide icon name */
  icon: z.string().optional().describe("Lucide icon name"),
  /** Whether section is expanded by default */
  defaultExpanded: z.boolean().default(true).describe("Whether section is expanded by default"),
  /** Sort order — lower values appear first */
  order: z.number().default(0).describe("Sort order (lower = higher)")
});
var FieldGroupSchema = z.object({
  /** Group key (matches field.group value) */
  key: z.string().describe("Group key matching field.group values"),
  /** Display label */
  label: z.string().describe("Group display label"),
  /** Lucide icon name */
  icon: z.string().optional().describe("Lucide icon name"),
  /** Whether group is expanded by default */
  defaultExpanded: z.boolean().default(true).describe("Whether group is expanded by default"),
  /** Sort order — lower values appear first */
  order: z.number().default(0).describe("Sort order (lower = higher)")
});
var FieldEditorConfigSchema = z.object({
  /** Enable inline editing of field properties in the table */
  inlineEditing: z.boolean().default(true).describe("Enable inline editing of field properties"),
  /** Enable drag-and-drop field reordering */
  dragReorder: z.boolean().default(true).describe("Enable drag-and-drop field reordering"),
  /** Show field group headers for organizing fields */
  showFieldGroups: z.boolean().default(true).describe("Show field group headers"),
  /** Show the type-specific property panel on the right */
  showPropertyPanel: z.boolean().default(true).describe("Show the right-side property panel"),
  /** Default property panel sections to display */
  propertySections: z.array(FieldPropertySectionSchema).default([
    { key: "basics", label: "Basic Properties", defaultExpanded: true, order: 0 },
    { key: "constraints", label: "Constraints & Validation", defaultExpanded: true, order: 10 },
    { key: "relationship", label: "Relationship Config", defaultExpanded: true, order: 20 },
    { key: "display", label: "Display & UI", defaultExpanded: false, order: 30 },
    { key: "security", label: "Security & Compliance", defaultExpanded: false, order: 40 },
    { key: "advanced", label: "Advanced", defaultExpanded: false, order: 50 }
  ]).describe("Property panel section definitions"),
  /** Field groups for organizing fields in the editor */
  fieldGroups: z.array(FieldGroupSchema).default([]).describe("Field group definitions"),
  /** Maximum fields before pagination kicks in */
  paginationThreshold: z.number().default(50).describe("Number of fields before pagination is enabled"),
  /** Enable batch field operations (add multiple fields at once) */
  batchOperations: z.boolean().default(true).describe("Enable batch add/remove field operations"),
  /** Show field usage statistics (views, formulas, relationships referencing this field) */
  showUsageStats: z.boolean().default(false).describe("Show field usage statistics")
});
var RelationshipDisplaySchema = z.object({
  /** Relationship type to configure */
  type: z.enum(["lookup", "master_detail", "tree"]).describe("Relationship type"),
  /** Line style for this relationship type */
  lineStyle: z.enum(["solid", "dashed", "dotted"]).default("solid").describe("Line style in diagrams"),
  /** Line color (CSS color value) */
  color: z.string().default("#94a3b8").describe("Line color (CSS value)"),
  /** Highlighted color on hover/select */
  highlightColor: z.string().default("#0891b2").describe("Highlighted color on hover/select"),
  /** Cardinality label to display */
  cardinalityLabel: z.string().default("1:N").describe('Cardinality label (e.g., "1:N", "1:1", "N:M")')
});
var RelationshipMapperConfigSchema = z.object({
  /** Enable visual relationship creation (drag from source to target) */
  visualCreation: z.boolean().default(true).describe("Enable drag-to-create relationships"),
  /** Show reverse relationships (child → parent) */
  showReverseRelationships: z.boolean().default(true).describe("Show reverse/child-to-parent relationships"),
  /** Show cascade delete warnings */
  showCascadeWarnings: z.boolean().default(true).describe("Show cascade delete behavior warnings"),
  /** Relationship display configuration by type */
  displayConfig: z.array(RelationshipDisplaySchema).default([
    { type: "lookup", lineStyle: "dashed", color: "#0891b2", highlightColor: "#06b6d4", cardinalityLabel: "1:N" },
    { type: "master_detail", lineStyle: "solid", color: "#ea580c", highlightColor: "#f97316", cardinalityLabel: "1:N" },
    { type: "tree", lineStyle: "dotted", color: "#8b5cf6", highlightColor: "#a78bfa", cardinalityLabel: "1:N" }
  ]).describe("Visual config per relationship type")
});
var ERLayoutAlgorithmSchema = z.enum([
  "force",
  // Force-directed graph (natural clustering)
  "hierarchy",
  // Top-down hierarchy (master → detail)
  "grid",
  // Uniform grid layout
  "circular"
  // Circular arrangement
]).describe("ER diagram layout algorithm");
var ERNodeDisplaySchema = z.object({
  /** Show field list within the node */
  showFields: z.boolean().default(true).describe("Show field list inside entity nodes"),
  /** Maximum fields to show before collapsing (0 = no limit) */
  maxFieldsVisible: z.number().default(8).describe('Max fields visible before "N more..." collapse'),
  /** Show field types alongside field names */
  showFieldTypes: z.boolean().default(true).describe("Show field type badges"),
  /** Show required field indicators */
  showRequiredIndicator: z.boolean().default(true).describe("Show required field indicators"),
  /** Show record count on each node (requires data access) */
  showRecordCount: z.boolean().default(false).describe("Show live record count on nodes"),
  /** Show object icon */
  showIcon: z.boolean().default(true).describe("Show object icon on node header"),
  /** Show object description on hover tooltip */
  showDescription: z.boolean().default(true).describe("Show description tooltip on hover")
});
var ERDiagramConfigSchema = z.object({
  /** Enable the ER diagram panel */
  enabled: z.boolean().default(true).describe("Enable ER diagram panel"),
  /** Default layout algorithm */
  layout: ERLayoutAlgorithmSchema.default("force").describe("Default layout algorithm"),
  /** Node display options */
  nodeDisplay: ERNodeDisplaySchema.default({
    showFields: true,
    maxFieldsVisible: 8,
    showFieldTypes: true,
    showRequiredIndicator: true,
    showRecordCount: false,
    showIcon: true,
    showDescription: true
  }).describe("Node display configuration"),
  /** Show minimap for navigation */
  showMinimap: z.boolean().default(true).describe("Show minimap for large diagrams"),
  /** Enable zoom controls */
  zoomControls: z.boolean().default(true).describe("Show zoom in/out/fit controls"),
  /** Minimum zoom level */
  minZoom: z.number().default(0.1).describe("Minimum zoom level"),
  /** Maximum zoom level */
  maxZoom: z.number().default(3).describe("Maximum zoom level"),
  /** Show relationship labels (cardinality) on edges */
  showEdgeLabels: z.boolean().default(true).describe("Show cardinality labels on relationship edges"),
  /** Highlight connected entities on hover */
  highlightOnHover: z.boolean().default(true).describe("Highlight connected entities on node hover"),
  /** Click behavior: navigate to object designer */
  clickToNavigate: z.boolean().default(true).describe("Click node to navigate to object detail"),
  /** Enable drag-and-drop to create relationships */
  dragToConnect: z.boolean().default(true).describe("Drag between nodes to create relationships"),
  /** Filter to show only objects with relationships (hide orphans) */
  hideOrphans: z.boolean().default(false).describe("Hide objects with no relationships"),
  /** Auto-fit diagram to viewport on initial load */
  autoFit: z.boolean().default(true).describe("Auto-fit diagram to viewport on load"),
  /** Export diagram options */
  exportFormats: z.array(z.enum(["png", "svg", "json"])).default(["png", "svg"]).describe("Available export formats for diagram")
});
var ObjectListDisplayModeSchema = z.enum([
  "table",
  // Traditional table with columns
  "cards",
  // Card grid (visual overview)
  "tree"
  // Hierarchical tree (grouped by package/namespace)
]).describe("Object list display mode");
var ObjectSortFieldSchema = z.enum([
  "name",
  // Sort by API name
  "label",
  // Sort by display label
  "fieldCount",
  // Sort by number of fields
  "updatedAt"
  // Sort by last modified
]).describe("Object list sort field");
var ObjectFilterSchema = z.object({
  /** Filter by package/namespace */
  package: z.string().optional().describe("Filter by owning package"),
  /** Filter by tags */
  tags: z.array(z.string()).optional().describe("Filter by object tags"),
  /** Show system objects */
  includeSystem: z.boolean().default(false).describe("Include system-level objects"),
  /** Show abstract objects */
  includeAbstract: z.boolean().default(false).describe("Include abstract base objects"),
  /** Show only objects with specific field types */
  hasFieldType: z.string().optional().describe("Filter to objects containing a specific field type"),
  /** Show only objects with relationships */
  hasRelationships: z.boolean().optional().describe("Filter to objects with lookup/master_detail fields"),
  /** Text search across name, label, description */
  searchQuery: z.string().optional().describe("Free-text search across name, label, and description")
});
var ObjectManagerConfigSchema = z.object({
  /** Default display mode */
  defaultDisplayMode: ObjectListDisplayModeSchema.default("table").describe("Default list display mode"),
  /** Default sort field */
  defaultSortField: ObjectSortFieldSchema.default("label").describe("Default sort field"),
  /** Default sort direction */
  defaultSortDirection: z.enum(["asc", "desc"]).default("asc").describe("Default sort direction"),
  /** Default filters */
  defaultFilter: ObjectFilterSchema.default({
    includeSystem: false,
    includeAbstract: false
  }).describe("Default filter configuration"),
  /** Show field count badge on each object row */
  showFieldCount: z.boolean().default(true).describe("Show field count badge"),
  /** Show relationship count badge */
  showRelationshipCount: z.boolean().default(true).describe("Show relationship count badge"),
  /** Show quick-preview tooltip with field list on hover */
  showQuickPreview: z.boolean().default(true).describe("Show quick field preview tooltip on hover"),
  /** Enable object comparison (diff two objects side-by-side) */
  enableComparison: z.boolean().default(false).describe("Enable side-by-side object comparison"),
  /** Show ER diagram toggle button in the toolbar */
  showERDiagramToggle: z.boolean().default(true).describe("Show ER diagram toggle in toolbar"),
  /** Show "Create Object" quick action */
  showCreateAction: z.boolean().default(true).describe("Show create object action"),
  /** Show object statistics summary bar (total objects, fields, relationships) */
  showStatsSummary: z.boolean().default(true).describe("Show statistics summary bar")
});
var ObjectPreviewTabSchema = z.object({
  /** Tab key */
  key: z.string().describe("Tab key"),
  /** Tab display label */
  label: z.string().describe("Tab display label"),
  /** Lucide icon name */
  icon: z.string().optional().describe("Lucide icon name"),
  /** Whether this tab is enabled */
  enabled: z.boolean().default(true).describe("Whether this tab is available"),
  /** Sort order */
  order: z.number().default(0).describe("Sort order (lower = higher)")
});
var ObjectPreviewConfigSchema = z.object({
  /** Tabs to show in the object detail view */
  tabs: z.array(ObjectPreviewTabSchema).default([
    { key: "fields", label: "Fields", icon: "list", enabled: true, order: 0 },
    { key: "relationships", label: "Relationships", icon: "link", enabled: true, order: 10 },
    { key: "indexes", label: "Indexes", icon: "zap", enabled: true, order: 20 },
    { key: "validations", label: "Validations", icon: "shield-check", enabled: true, order: 30 },
    { key: "capabilities", label: "Capabilities", icon: "settings", enabled: true, order: 40 },
    { key: "data", label: "Data", icon: "table-2", enabled: true, order: 50 },
    { key: "api", label: "API", icon: "globe", enabled: true, order: 60 },
    { key: "code", label: "Code", icon: "code-2", enabled: true, order: 70 }
  ]).describe("Object detail preview tabs"),
  /** Default active tab */
  defaultTab: z.string().default("fields").describe("Default active tab key"),
  /** Show object header with summary info */
  showHeader: z.boolean().default(true).describe("Show object summary header"),
  /** Show breadcrumbs */
  showBreadcrumbs: z.boolean().default(true).describe("Show navigation breadcrumbs")
});
var ObjectDesignerDefaultViewSchema = z.enum([
  "field-editor",
  // Field table editor (default)
  "relationship-mapper",
  // Visual relationship view
  "er-diagram",
  // Full ER diagram
  "object-manager"
  // Object list/manager
]).describe("Default view when entering the Object Designer");
var ObjectDesignerConfigSchema = z.object({
  /** Default view when opening the designer */
  defaultView: ObjectDesignerDefaultViewSchema.default("field-editor").describe("Default view"),
  /** Field editor configuration */
  fieldEditor: FieldEditorConfigSchema.default({
    inlineEditing: true,
    dragReorder: true,
    showFieldGroups: true,
    showPropertyPanel: true,
    propertySections: [
      { key: "basics", label: "Basic Properties", defaultExpanded: true, order: 0 },
      { key: "constraints", label: "Constraints & Validation", defaultExpanded: true, order: 10 },
      { key: "relationship", label: "Relationship Config", defaultExpanded: true, order: 20 },
      { key: "display", label: "Display & UI", defaultExpanded: false, order: 30 },
      { key: "security", label: "Security & Compliance", defaultExpanded: false, order: 40 },
      { key: "advanced", label: "Advanced", defaultExpanded: false, order: 50 }
    ],
    fieldGroups: [],
    paginationThreshold: 50,
    batchOperations: true,
    showUsageStats: false
  }).describe("Field editor configuration"),
  /** Relationship mapper configuration */
  relationshipMapper: RelationshipMapperConfigSchema.default({
    visualCreation: true,
    showReverseRelationships: true,
    showCascadeWarnings: true,
    displayConfig: [
      { type: "lookup", lineStyle: "dashed", color: "#0891b2", highlightColor: "#06b6d4", cardinalityLabel: "1:N" },
      { type: "master_detail", lineStyle: "solid", color: "#ea580c", highlightColor: "#f97316", cardinalityLabel: "1:N" },
      { type: "tree", lineStyle: "dotted", color: "#8b5cf6", highlightColor: "#a78bfa", cardinalityLabel: "1:N" }
    ]
  }).describe("Relationship mapper configuration"),
  /** ER diagram configuration */
  erDiagram: ERDiagramConfigSchema.default({
    enabled: true,
    layout: "force",
    nodeDisplay: {
      showFields: true,
      maxFieldsVisible: 8,
      showFieldTypes: true,
      showRequiredIndicator: true,
      showRecordCount: false,
      showIcon: true,
      showDescription: true
    },
    showMinimap: true,
    zoomControls: true,
    minZoom: 0.1,
    maxZoom: 3,
    showEdgeLabels: true,
    highlightOnHover: true,
    clickToNavigate: true,
    dragToConnect: true,
    hideOrphans: false,
    autoFit: true,
    exportFormats: ["png", "svg"]
  }).describe("ER diagram configuration"),
  /** Object manager configuration */
  objectManager: ObjectManagerConfigSchema.default({
    defaultDisplayMode: "table",
    defaultSortField: "label",
    defaultSortDirection: "asc",
    defaultFilter: {
      includeSystem: false,
      includeAbstract: false
    },
    showFieldCount: true,
    showRelationshipCount: true,
    showQuickPreview: true,
    enableComparison: false,
    showERDiagramToggle: true,
    showCreateAction: true,
    showStatsSummary: true
  }).describe("Object manager configuration"),
  /** Object preview configuration */
  objectPreview: ObjectPreviewConfigSchema.default({
    tabs: [
      { key: "fields", label: "Fields", icon: "list", enabled: true, order: 0 },
      { key: "relationships", label: "Relationships", icon: "link", enabled: true, order: 10 },
      { key: "indexes", label: "Indexes", icon: "zap", enabled: true, order: 20 },
      { key: "validations", label: "Validations", icon: "shield-check", enabled: true, order: 30 },
      { key: "capabilities", label: "Capabilities", icon: "settings", enabled: true, order: 40 },
      { key: "data", label: "Data", icon: "table-2", enabled: true, order: 50 },
      { key: "api", label: "API", icon: "globe", enabled: true, order: 60 },
      { key: "code", label: "Code", icon: "code-2", enabled: true, order: 70 }
    ],
    defaultTab: "fields",
    showHeader: true,
    showBreadcrumbs: true
  }).describe("Object preview configuration")
});
function defineObjectDesignerConfig(input) {
  return ObjectDesignerConfigSchema.parse(input);
}
var CanvasSnapSettingsSchema = z.object({
  enabled: z.boolean().default(true).describe("Enable snap-to-grid"),
  gridSize: z.number().int().min(1).default(8).describe("Snap grid size in pixels"),
  showGrid: z.boolean().default(true).describe("Show grid overlay on canvas"),
  showGuides: z.boolean().default(true).describe("Show alignment guides when dragging")
});
var CanvasZoomSettingsSchema = z.object({
  min: z.number().min(0.1).default(0.25).describe("Minimum zoom level"),
  max: z.number().max(10).default(3).describe("Maximum zoom level"),
  default: z.number().default(1).describe("Default zoom level"),
  step: z.number().default(0.1).describe("Zoom step increment")
});
var ElementPaletteItemSchema = z.object({
  type: z.string().describe('Component type (e.g. "element:button", "element:text")'),
  label: z.string().describe("Display label in palette"),
  icon: z.string().optional().describe("Icon name for palette display"),
  category: z.enum(["content", "interactive", "data", "layout"]).describe("Palette category grouping"),
  defaultWidth: z.number().int().min(1).default(4).describe("Default width in grid columns"),
  defaultHeight: z.number().int().min(1).default(2).describe("Default height in grid rows")
});
var PageBuilderConfigSchema = z.object({
  snap: CanvasSnapSettingsSchema.optional().describe("Canvas snap settings"),
  zoom: CanvasZoomSettingsSchema.optional().describe("Canvas zoom settings"),
  palette: z.array(ElementPaletteItemSchema).optional().describe("Custom element palette (defaults to all registered elements)"),
  showLayerPanel: z.boolean().default(true).describe("Show layer ordering panel"),
  showPropertyPanel: z.boolean().default(true).describe("Show property inspector panel"),
  undoLimit: z.number().int().min(1).default(50).describe("Maximum undo history steps")
});
var InterfaceBuilderConfigSchema = PageBuilderConfigSchema;
var FlowNodeShapeSchema = z.enum([
  "rounded_rect",
  // Default activity shape (assignments, CRUD, HTTP, script, subflow)
  "circle",
  // Start / End events
  "diamond",
  // Decision (XOR gateway)
  "parallelogram",
  // Loop / iteration
  "hexagon",
  // Wait / timer event
  "diamond_thick",
  // Parallel gateway (AND-split) & Join gateway (AND-join)
  "attached_circle",
  // Boundary event (attached to host node)
  "screen_rect"
  // Screen / user-interaction node
]).describe("Visual shape for rendering a flow node on the canvas");
var FlowNodeRenderDescriptorSchema = z.object({
  /** The node action type this descriptor applies to */
  action: z.string().describe('FlowNodeAction value (e.g., "parallel_gateway")'),
  /** Visual shape on the canvas */
  shape: FlowNodeShapeSchema.describe("Shape to render"),
  /** Lucide icon name displayed inside the node */
  icon: z.string().describe("Lucide icon name"),
  /** Default label shown on the node when no user label is set */
  defaultLabel: z.string().describe("Default display label"),
  /** Default width in canvas pixels */
  defaultWidth: z.number().int().min(20).default(120).describe("Default width in pixels"),
  /** Default height in canvas pixels */
  defaultHeight: z.number().int().min(20).default(60).describe("Default height in pixels"),
  /** CSS color for the node fill */
  fillColor: z.string().default("#ffffff").describe("Node fill color (CSS value)"),
  /** CSS color for the node border */
  borderColor: z.string().default("#94a3b8").describe("Node border color (CSS value)"),
  /** Whether this node type can have boundary events attached */
  allowBoundaryEvents: z.boolean().default(false).describe("Whether boundary events can be attached to this node type"),
  /** Category for palette grouping */
  paletteCategory: z.enum(["event", "gateway", "activity", "data", "subflow"]).describe("Palette category for grouping")
}).describe("Visual render descriptor for a flow node type");
var FlowCanvasNodeSchema = z.object({
  /** Reference to the flow node id */
  nodeId: z.string().describe("Corresponding FlowNode.id"),
  /** X position on the canvas (pixels) */
  x: z.number().describe("X position on canvas"),
  /** Y position on the canvas (pixels) */
  y: z.number().describe("Y position on canvas"),
  /** Width override (pixels, optional — uses descriptor default) */
  width: z.number().int().min(20).optional().describe("Width override in pixels"),
  /** Height override (pixels, optional — uses descriptor default) */
  height: z.number().int().min(20).optional().describe("Height override in pixels"),
  /** Whether the node is collapsed (hides internal details) */
  collapsed: z.boolean().default(false).describe("Whether the node is collapsed"),
  /** Custom fill color override */
  fillColor: z.string().optional().describe("Fill color override"),
  /** Custom border color override */
  borderColor: z.string().optional().describe("Border color override"),
  /** User-defined comment/annotation visible on canvas */
  annotation: z.string().optional().describe("User annotation displayed near the node")
}).describe("Canvas layout data for a flow node");
var FlowCanvasEdgeStyleSchema = z.enum([
  "solid",
  // Normal sequence flow
  "dashed",
  // Default sequence flow (isDefault: true)
  "dotted",
  // Conditional edge
  "bold"
  // Fault / error edge
]).describe("Edge line style");
var FlowCanvasEdgeSchema = z.object({
  /** Reference to the flow edge id */
  edgeId: z.string().describe("Corresponding FlowEdge.id"),
  /** Line style */
  style: FlowCanvasEdgeStyleSchema.default("solid").describe("Line style"),
  /** Line color (CSS value) */
  color: z.string().default("#94a3b8").describe("Edge line color"),
  /** Label position along the edge (0–1, 0.5 = midpoint) */
  labelPosition: z.number().min(0).max(1).default(0.5).describe("Position of the condition label along the edge"),
  /** Optional waypoints for routing the edge around nodes */
  waypoints: z.array(z.object({
    x: z.number().describe("Waypoint X"),
    y: z.number().describe("Waypoint Y")
  })).optional().describe("Manual waypoints for edge routing"),
  /** Whether to show an animated flow indicator */
  animated: z.boolean().default(false).describe("Show animated flow indicator")
}).describe("Canvas layout and visual data for a flow edge");
var FlowLayoutAlgorithmSchema = z.enum([
  "dagre",
  // Directed acyclic graph layout (top-down or left-right)
  "elk",
  // Eclipse Layout Kernel (advanced hierarchical)
  "force",
  // Force-directed graph
  "manual"
  // User-positioned (no auto-layout)
]).describe("Auto-layout algorithm for the flow canvas");
var FlowLayoutDirectionSchema = z.enum([
  "TB",
  // Top to bottom
  "BT",
  // Bottom to top
  "LR",
  // Left to right
  "RL"
  // Right to left
]).describe("Auto-layout direction");
var FlowBuilderConfigSchema = z.object({
  /** Canvas snap settings */
  snap: z.object({
    enabled: z.boolean().default(true).describe("Enable snap-to-grid"),
    gridSize: z.number().int().min(1).default(16).describe("Snap grid size in pixels"),
    showGrid: z.boolean().default(true).describe("Show grid overlay")
  }).default({ enabled: true, gridSize: 16, showGrid: true }).describe("Canvas snap-to-grid settings"),
  /** Canvas zoom settings */
  zoom: z.object({
    min: z.number().min(0.1).default(0.25).describe("Minimum zoom level"),
    max: z.number().max(10).default(3).describe("Maximum zoom level"),
    default: z.number().default(1).describe("Default zoom level"),
    step: z.number().default(0.1).describe("Zoom step")
  }).default({ min: 0.25, max: 3, default: 1, step: 0.1 }).describe("Canvas zoom settings"),
  /** Auto-layout algorithm */
  layoutAlgorithm: FlowLayoutAlgorithmSchema.default("dagre").describe("Default auto-layout algorithm"),
  /** Auto-layout direction */
  layoutDirection: FlowLayoutDirectionSchema.default("TB").describe("Default auto-layout direction"),
  /** Node render descriptors (override defaults per node type) */
  nodeDescriptors: z.array(FlowNodeRenderDescriptorSchema).optional().describe("Custom node render descriptors (merged with built-in defaults)"),
  /** Show minimap for navigation */
  showMinimap: z.boolean().default(true).describe("Show minimap panel"),
  /** Show the node property panel */
  showPropertyPanel: z.boolean().default(true).describe("Show property panel"),
  /** Show the node palette sidebar */
  showPalette: z.boolean().default(true).describe("Show node palette sidebar"),
  /** Maximum undo history steps */
  undoLimit: z.number().int().min(1).default(50).describe("Maximum undo history steps"),
  /** Enable edge animation during execution preview */
  animateExecution: z.boolean().default(true).describe("Animate edges during execution preview"),
  /** Connection validation — prevent invalid edges (e.g., duplicate, self-loop) */
  connectionValidation: z.boolean().default(true).describe("Validate connections before creating edges")
}).describe("Studio Flow Builder configuration");
var BUILT_IN_NODE_DESCRIPTORS = [
  { action: "start", shape: "circle", icon: "play", defaultLabel: "Start", defaultWidth: 60, defaultHeight: 60, fillColor: "#dcfce7", borderColor: "#16a34a", allowBoundaryEvents: false, paletteCategory: "event" },
  { action: "end", shape: "circle", icon: "square", defaultLabel: "End", defaultWidth: 60, defaultHeight: 60, fillColor: "#fee2e2", borderColor: "#dc2626", allowBoundaryEvents: false, paletteCategory: "event" },
  { action: "decision", shape: "diamond", icon: "git-branch", defaultLabel: "Decision", defaultWidth: 80, defaultHeight: 80, fillColor: "#fef9c3", borderColor: "#ca8a04", allowBoundaryEvents: false, paletteCategory: "gateway" },
  { action: "parallel_gateway", shape: "diamond_thick", icon: "git-fork", defaultLabel: "Parallel Gateway", defaultWidth: 80, defaultHeight: 80, fillColor: "#dbeafe", borderColor: "#2563eb", allowBoundaryEvents: false, paletteCategory: "gateway" },
  { action: "join_gateway", shape: "diamond_thick", icon: "git-merge", defaultLabel: "Join Gateway", defaultWidth: 80, defaultHeight: 80, fillColor: "#dbeafe", borderColor: "#2563eb", allowBoundaryEvents: false, paletteCategory: "gateway" },
  { action: "wait", shape: "hexagon", icon: "clock", defaultLabel: "Wait", defaultWidth: 100, defaultHeight: 60, fillColor: "#f3e8ff", borderColor: "#7c3aed", allowBoundaryEvents: true, paletteCategory: "event" },
  { action: "boundary_event", shape: "attached_circle", icon: "alert-circle", defaultLabel: "Boundary Event", defaultWidth: 40, defaultHeight: 40, fillColor: "#fff7ed", borderColor: "#ea580c", allowBoundaryEvents: false, paletteCategory: "event" },
  { action: "assignment", shape: "rounded_rect", icon: "pen-line", defaultLabel: "Assignment", defaultWidth: 120, defaultHeight: 60, fillColor: "#ffffff", borderColor: "#94a3b8", allowBoundaryEvents: true, paletteCategory: "activity" },
  { action: "create_record", shape: "rounded_rect", icon: "plus-circle", defaultLabel: "Create Record", defaultWidth: 120, defaultHeight: 60, fillColor: "#ffffff", borderColor: "#94a3b8", allowBoundaryEvents: true, paletteCategory: "data" },
  { action: "update_record", shape: "rounded_rect", icon: "edit", defaultLabel: "Update Record", defaultWidth: 120, defaultHeight: 60, fillColor: "#ffffff", borderColor: "#94a3b8", allowBoundaryEvents: true, paletteCategory: "data" },
  { action: "delete_record", shape: "rounded_rect", icon: "trash-2", defaultLabel: "Delete Record", defaultWidth: 120, defaultHeight: 60, fillColor: "#ffffff", borderColor: "#94a3b8", allowBoundaryEvents: true, paletteCategory: "data" },
  { action: "get_record", shape: "rounded_rect", icon: "search", defaultLabel: "Get Record", defaultWidth: 120, defaultHeight: 60, fillColor: "#ffffff", borderColor: "#94a3b8", allowBoundaryEvents: true, paletteCategory: "data" },
  { action: "http_request", shape: "rounded_rect", icon: "globe", defaultLabel: "HTTP Request", defaultWidth: 120, defaultHeight: 60, fillColor: "#ffffff", borderColor: "#94a3b8", allowBoundaryEvents: true, paletteCategory: "activity" },
  { action: "script", shape: "rounded_rect", icon: "code", defaultLabel: "Script", defaultWidth: 120, defaultHeight: 60, fillColor: "#ffffff", borderColor: "#94a3b8", allowBoundaryEvents: true, paletteCategory: "activity" },
  { action: "screen", shape: "screen_rect", icon: "monitor", defaultLabel: "Screen", defaultWidth: 140, defaultHeight: 80, fillColor: "#f0f9ff", borderColor: "#0284c7", allowBoundaryEvents: false, paletteCategory: "activity" },
  { action: "loop", shape: "parallelogram", icon: "repeat", defaultLabel: "Loop", defaultWidth: 120, defaultHeight: 60, fillColor: "#fef3c7", borderColor: "#d97706", allowBoundaryEvents: true, paletteCategory: "activity" },
  { action: "subflow", shape: "rounded_rect", icon: "layers", defaultLabel: "Subflow", defaultWidth: 140, defaultHeight: 70, fillColor: "#ede9fe", borderColor: "#7c3aed", allowBoundaryEvents: true, paletteCategory: "subflow" },
  { action: "connector_action", shape: "rounded_rect", icon: "plug", defaultLabel: "Connector", defaultWidth: 120, defaultHeight: 60, fillColor: "#ffffff", borderColor: "#94a3b8", allowBoundaryEvents: true, paletteCategory: "activity" }
];
function defineFlowBuilderConfig(input) {
  return FlowBuilderConfigSchema.parse(input);
}

export { ActionContributionSchema, ActionLocationSchema, ActivationEventSchema, BUILT_IN_NODE_DESCRIPTORS, CanvasSnapSettingsSchema, CanvasZoomSettingsSchema, CommandContributionSchema, ERDiagramConfigSchema, ERLayoutAlgorithmSchema, ERNodeDisplaySchema, ElementPaletteItemSchema, FieldEditorConfigSchema, FieldGroupSchema, FieldPropertySectionSchema, FlowBuilderConfigSchema, FlowCanvasEdgeSchema, FlowCanvasEdgeStyleSchema, FlowCanvasNodeSchema, FlowLayoutAlgorithmSchema, FlowLayoutDirectionSchema, FlowNodeRenderDescriptorSchema, FlowNodeShapeSchema, InterfaceBuilderConfigSchema, MetadataIconContributionSchema, MetadataViewerContributionSchema, ObjectDesignerConfigSchema, ObjectDesignerDefaultViewSchema, ObjectFilterSchema, ObjectListDisplayModeSchema, ObjectManagerConfigSchema, ObjectPreviewConfigSchema, ObjectPreviewTabSchema, ObjectSortFieldSchema, PageBuilderConfigSchema, PanelContributionSchema, PanelLocationSchema, RelationshipDisplaySchema, RelationshipMapperConfigSchema, SidebarGroupContributionSchema, StudioPluginContributionsSchema, StudioPluginManifestSchema, ViewModeSchema, defineFlowBuilderConfig, defineObjectDesignerConfig, defineStudioPlugin };
//# sourceMappingURL=index.mjs.map
//# sourceMappingURL=index.mjs.map