{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/proactions-ai-kit-configuration-for-sections/_shared/latest--partial-action.schema.json",
  "title": "ProActions Action Schema",
  "description": "Schema for a single action entry used inside a section",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/em-al-wi/proactions-schema/main/schema/partial-action.schema.json",
    "sourceSha256": "687ed5f92953fe89a24661e44b5c3efd79bf9d9186c4b934f3c8774bd6d3b557"
  },
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the action"
    },
    "title": {
      "type": "string",
      "description": "Display title for the action"
    },
    "category": {
      "type": "string",
      "description": "Category for sub-grouping actions"
    },
    "context": {
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "all",
            "report",
            "story",
            "dwp",
            "dashboard"
          ]
        },
        {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "all",
              "report",
              "story",
              "dwp",
              "dashboard"
            ]
          }
        }
      ],
      "description": "Document context where this action appears"
    },
    "keywords": {
      "type": "string",
      "description": "Search keywords for finding this action"
    },
    "icon": {
      "type": "string",
      "description": "Icon HTML for the action"
    },
    "flow": {
      "type": "array",
      "description": "List of steps to execute",
      "items": {
        "$ref": "https://catalog.lintel.tools/schemas/schemastore/proactions-ai-kit-configuration-for-sections/_shared/latest--partial-step.schema.json"
      }
    },
    "onError": {
      "type": "array",
      "description": "Steps to execute if an error occurs",
      "items": {
        "$ref": "https://catalog.lintel.tools/schemas/schemastore/proactions-ai-kit-configuration-for-sections/_shared/latest--partial-step.schema.json"
      }
    },
    "hidden": {
      "type": "boolean",
      "description": "Whether this action is hidden from UI"
    },
    "isAvailable": {
      "type": "string",
      "description": "Condition for when action is available"
    },
    "panelContext": {
      "type": "array",
      "description": "Context specifications for panel display",
      "items": {
        "type": "object",
        "properties": {
          "forXPath": {
            "type": "string",
            "description": "XPath for context matching"
          },
          "forTextSelection": {
            "type": "boolean",
            "description": "Applies to text selections"
          },
          "forElement": {
            "type": "string",
            "description": "Element type for matching"
          }
        }
      }
    },
    "swing": {
      "type": "object",
      "description": "Swing Web Client native integrations (v1.1.0+)",
      "properties": {
        "inlineMenu": {
          "type": "object",
          "description": "Add button to inline text editor toolbar (appears when selecting text)",
          "properties": {
            "enable": {
              "type": "boolean",
              "description": "Enable this integration"
            },
            "label": {
              "type": "string",
              "description": "Button label text (defaults to action title)"
            },
            "icon": {
              "type": "string",
              "description": "FontAwesome icon class (e.g., 'fa fa-magic')"
            },
            "allowReadOnly": {
              "type": "boolean",
              "description": "Allow button to be active in read-only mode",
              "default": false
            },
            "isEnabled": {
              "type": "string",
              "description": "Nunjucks expression for button enablement (e.g., '{{ client.isTextSelected() }}')"
            },
            "isActive": {
              "type": "string",
              "description": "Nunjucks expression for button visibility"
            }
          },
          "required": [
            "enable"
          ]
        },
        "objectAction": {
          "type": "object",
          "description": "Add action to object three-dots menu (search results, preview pane, explorer)",
          "properties": {
            "enable": {
              "type": "boolean",
              "description": "Enable this integration"
            }
          },
          "required": [
            "enable"
          ]
        },
        "contextMenu": {
          "type": "object",
          "description": "Add item to right-click context menus (Explorer and other contexts)",
          "properties": {
            "enable": {
              "type": "boolean",
              "description": "Enable this integration"
            }
          },
          "required": [
            "enable"
          ]
        }
      }
    }
  },
  "required": [
    "title",
    "flow"
  ]
}
