{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Tour Configuration Schema",
    "description": "Complete tour configuration schema for guided tours",
    "type": "object",
    "required": ["id"],
    "properties": {
      "id": {
        "type": "string",
        "description": "Unique identifier for the tour"
      },
      "steps": {
        "type": "array",
        "description": "Array of tour step configurations",
        "items": {
          "$ref": "#/definitions/TourStepConfiguration"
        }
      },
      "stepDefaults": {
        "description": "Default settings applied to all steps. Individual step settings will override these defaults",
        "$ref": "#/definitions/TourStepDefaultsConfiguration"
      },
      "keyboard": {
        "description": "Keyboard interaction settings",
        "$ref": "#/definitions/KeyboardSettings"
      },
      "exit": {
        "description": "Exit behavior settings",
        "$ref": "#/definitions/ExitSettings"
      },
      "visual": {
        "description": "Visual appearance settings",
        "$ref": "#/definitions/VisualSettings"
      }
    },
    "definitions": {
      "TourStepConfiguration": {
        "type": "object",
        "required": ["id"],
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the step"
          },
          "content": {
            "$ref": "#/definitions/TourStepContent",
            "description": "Content configuration"
          },
          "target": {
            "$ref": "#/definitions/TargetElement",
            "description": "Target element configuration"
          },
          "container": {
            "$ref": "#/definitions/StepContainerSettings",
            "description": "Container configuration"
          },
          "highlight": {
            "$ref": "#/definitions/HighlightSettings",
            "description": "Highlight configuration"
          },
          "navigation": {
            "$ref": "#/definitions/TourStepNavigation",
            "description": "Navigation configuration"
          },
          "behavior": {
            "$ref": "#/definitions/TourStepBehavior",
            "description": "Behavior configuration"
          },
          "lifecycle": {
            "$ref": "#/definitions/TourStepLifecycle",
            "description": "Lifecycle DOM interactions run automatically on step enter/exit"
          },
          "canClickTarget": {
            "type": "boolean",
            "description": "Controls whether users can interact with the step target element",
            "default": true
          },
          "showProgressIndicator": {
            "type": "boolean",
            "description": "Controls visibility of the progress indicator showing current step number and total steps",
            "default": false
          }
        },
        "additionalProperties": false
      },
      "TourStepDefaultsConfiguration": {
        "type": "object",
        "properties": {
          "content": {
            "$ref": "#/definitions/TourStepContent",
            "description": "Content configuration"
          },
          "target": {
            "$ref": "#/definitions/TargetElement",
            "description": "Target element configuration"
          },
          "container": {
            "$ref": "#/definitions/StepContainerSettings",
            "description": "Container configuration"
          },
          "highlight": {
            "$ref": "#/definitions/HighlightSettings",
            "description": "Highlight configuration"
          },
          "navigation": {
            "$ref": "#/definitions/TourStepNavigation",
            "description": "Navigation configuration"
          },
          "behavior": {
            "$ref": "#/definitions/TourStepBehavior",
            "description": "Behavior configuration"
          },
          "lifecycle": {
            "$ref": "#/definitions/TourStepLifecycle",
            "description": "Lifecycle DOM interactions run automatically on step enter/exit"
          },
          "canClickTarget": {
            "type": "boolean",
            "description": "Controls whether users can interact with the step target element",
            "default": true
          },
          "showProgressIndicator": {
            "type": "boolean",
            "description": "Controls visibility of the progress indicator showing current step number and total steps",
            "default": false
          }
        },
        "additionalProperties": false
      },
      "TourStepContent": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "Step title"
          },
          "body": {
            "type": "string",
            "description": "Step content/description body"
          },
          "image": {
            "$ref": "#/definitions/TourStepImage",
            "description": "Optional image to display in the step"
          }
        },
        "additionalProperties": false
      },
      "TourStepImage": {
        "type": "object",
        "required": ["src", "alt"],
        "properties": {
          "src": {
            "type": "string",
            "description": "Source URL for the image"
          },
          "alt": {
            "type": "string",
            "description": "Alternative text for accessibility"
          },
          "width": {
            "type": "number",
            "description": "Width of the image in pixels"
          },
          "height": {
            "type": "number",
            "description": "Height of the image in pixels"
          }
        },
        "additionalProperties": false
      },
      "TargetElement": {
        "type": "object",
        "properties": {
          "selector": {
            "type": "string",
            "description": "CSS selector for the target element"
          },
          "placement": {
            "type": "string",
            "enum": ["auto", "top", "right", "bottom", "left", "auto-start", "auto-end", "top-start", "top-end", "bottom-start", "bottom-end", "left-start", "left-end", "right-start", "right-end"],
            "description": "Position relative to target",
            "default": "auto"
          }
        },
        "additionalProperties": false
      },
      "StepContainerSettings": {
        "type": "object",
        "properties": {
          "arrow": {
            "oneOf": [
              {
                "type": "boolean",
                "description": "Controls visibility of directional arrow"
              },
              {
                "$ref": "#/definitions/CustomArrowImageOptions",
                "description": "Custom arrow image configuration"
              }
            ],
            "default": true
          },
          "offset": {
            "$ref": "#/definitions/OffsetValue",
            "description": "Offset configuration for the step container position"
          }
        },
        "additionalProperties": false
      },
      "HighlightSettings": {
        "type": "object",
        "properties": {
          "additionalHighlightSelectors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Additional element selectors to highlight during the step",
            "default": []
          },
          "xOffset": {
            "type": "number",
            "description": "X-axis offset in pixels",
            "default": 0
          },
          "yOffset": {
            "type": "number",
            "description": "Y-axis offset in pixels",
            "default": 0
          },
          "padding": {
            "type": "number",
            "description": "Padding for highlight area",
            "default": 0
          },
          "borderRadius": {
            "oneOf": [
              {
                "type": "number"
              },
              {
                "$ref": "#/definitions/BorderRadiusConfig"
              }
            ],
            "description": "Border radius for highlight area",
            "default": 0
          }
        },
        "additionalProperties": false
      },
      "BorderRadiusConfig": {
        "type": "object",
        "properties": {
          "topLeft": {
            "type": "number"
          },
          "bottomLeft": {
            "type": "number"
          },
          "bottomRight": {
            "type": "number"
          },
          "topRight": {
            "type": "number"
          }
        },
        "additionalProperties": false
      },
      "TourStepNavigation": {
        "type": "object",
        "properties": {
          "buttons": {
            "type": "array",
            "items": {
              "$ref": "#/definitions/StepOptionsButton"
            },
            "description": "Navigation buttons configuration"
          },
          "cancelIcon": {
            "$ref": "#/definitions/CancelIcon",
            "description": "Close button configuration"
          },
          "progressTrigger": {
            "$ref": "#/definitions/StepProgressTrigger",
            "description": "Automatic progression configuration"
          }
        },
        "additionalProperties": false
      },
      "StepOptionsButton": {
        "type": "object",
        "properties": {
          "tourActions": {
            "type": "array",
            "items": {
              "oneOf": [
                { "$ref": "#/definitions/TourAction" },
                { "$ref": "#/definitions/TourActionShow" },
                { "$ref": "#/definitions/TourActionRemoveStep" },
                { "$ref": "#/definitions/TourActionAddStep" },
                { "$ref": "#/definitions/TourActionAddSteps" },
                { "$ref": "#/definitions/TourActionDomEvent" }
              ]
            }
          },
          "text": {
            "type": "string",
            "description": "Button text content"
          },
          "ariaLabel": {
            "type": "string",
            "description": "Accessibility label"
          },
          "disabled": {
            "type": "boolean",
            "description": "Disabled state"
          },
          "secondary": {
            "type": "boolean",
            "description": "Secondary styling"
          },
           "classes": {
            "type": "string",
            "description": "Additional classes for styling"
          }
        },
        "additionalProperties": false
      },
      "TourAction": {
        "type": "object",
        "required": ["type"],
        "properties": {
          "type": {
            "type": "string",
            "enum": ["next", "back", "cancel", "complete", "hide"],
            "description": "Type of action to execute"
          }
        },
        "additionalProperties": false
      },
      "TourActionShow": {
        "type": "object",
        "required": ["type", "stepId"],
        "properties": {
          "type": {
            "const": "show"
          },
          "stepId": {
            "type": "string",
            "description": "ID of the step to show"
          }
        },
        "additionalProperties": false
      },
      "TourActionRemoveStep": {
        "type": "object",
        "required": ["type", "stepId"],
        "properties": {
          "type": {
            "const": "removeStep"
          },
          "stepId": {
            "type": "string",
            "description": "ID of the step to remove"
          }
        },
        "additionalProperties": false
      },
      "TourActionAddStep": {
        "type": "object",
        "required": ["type", "stepConfig"],
        "properties": {
          "type": {
            "const": "addStep"
          },
          "stepConfig": {
            "$ref": "#/definitions/TourStepConfiguration"
          }
        },
        "additionalProperties": false
      },
      "TourActionAddSteps": {
        "type": "object",
        "required": ["type", "stepConfigs"],
        "properties": {
          "type": {
            "const": "addSteps"
          },
          "stepConfigs": {
            "type": "array",
            "items": {
              "$ref": "#/definitions/TourStepConfiguration"
            }
          }
        },
        "additionalProperties": false
      },
      "TourActionDomEvent": {
        "type": "object",
        "required": ["type", "selector", "eventName"],
        "properties": {
          "type": {
            "const": "domEvent"
          },
          "selector": {
            "type": "string",
            "description": "Selector of the element to perform action"
          },
          "eventName": {
            "type": "string",
            "description": "DOM event to be dispatched on the selected element",
            "enum": [
              "click", "dblclick", "mousedown", "mouseup", "mouseover", "mouseout",
              "mousemove", "mouseenter", "mouseleave", "keydown", "keyup", "keypress",
              "focus", "blur", "input", "change", "submit", "reset", "select",
              "cut", "copy", "paste", "drag", "dragstart", "dragend", "dragenter",
              "dragleave", "dragover", "drop", "scroll", "wheel", "contextmenu",
              "touchstart", "touchmove", "touchend", "touchcancel", "cancelGuidedTour",
              "completeGuidedTour", "getGuidedTour", "getGuidedTours", "startGuidedTour"
            ]
          },
          "args": {
            "type": "array",
            "description": "Arguments to be passed to the DOM event or XGuidedTours method to be dispatched",
            "items": {
              "type": ["string", "number", "boolean", "object", "array", "null"]
            }
          }
        },
        "additionalProperties": false
      },
      "TourStepLifecycle": {
        "type": "object",
        "description": "Declarative DOM interactions run automatically as a step is entered and left. Hooks are restricted to domEvent actions and cannot alter tour flow. If a hook action fails the step is skipped.",
        "properties": {
          "beforeShow": {
            "type": "array",
            "description": "Actions run before the step is shown, before waiting for the target element",
            "items": { "$ref": "#/definitions/TourActionDomEvent" }
          },
          "onShow": {
            "type": "array",
            "description": "Actions run when the step is shown, after its element exists",
            "items": { "$ref": "#/definitions/TourActionDomEvent" }
          },
          "onHide": {
            "type": "array",
            "description": "Actions run when the step is hidden, used to revert side effects",
            "items": { "$ref": "#/definitions/TourActionDomEvent" }
          }
        },
        "additionalProperties": false
      },
      "CancelIcon": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Show close button icon"
          },
          "ariaLabel": {
            "type": "string",
            "description": "Accessibility label"
          }
        },
        "additionalProperties": false
      },
      "StepProgressTrigger": {
        "type": "object",
        "required": ["event", "selector"],
        "properties": {
          "event": {
            "type": "string",
            "description": "DOM event that triggers progression"
          },
          "selector": {
            "type": "string",
            "description": "Element selector for event listener"
          }
        },
        "additionalProperties": false
      },
      "TourStepBehavior": {
        "type": "object",
        "properties": {
          "waitForElementConditions": {
            "$ref": "#/definitions/WaitForElementConditions",
            "description": "Target element wait configuration"
          },
          "scrollToTarget": {
            "oneOf": [
              {
                "type": "boolean"
              },
              {
                "$ref": "#/definitions/ScrollIntoViewOptions"
              }
            ],
            "description": "Scroll behavior",
            "default": true
          }
        },
        "additionalProperties": false
      },
      "WaitForElementConditions": {
        "type": "object",
        "properties": {
          "waitTimeout": {
            "type": "number",
            "description": "Maximum wait time in milliseconds for element to exist",
            "default": 0
          },
          "skipStepIfTargetMissing": {
            "type": "boolean",
            "description": "Skip if element doesn't exist",
            "default": false
          }
        },
        "additionalProperties": false
      },
      "ScrollIntoViewOptions": {
        "type": "object",
        "properties": {
          "behavior": {
            "type": "string",
            "enum": ["auto", "smooth"],
            "description": "Scroll behavior"
          },
          "block": {
            "type": "string",
            "enum": ["start", "center", "end", "nearest"],
            "description": "Vertical alignment"
          },
          "inline": {
            "type": "string",
            "enum": ["start", "center", "end", "nearest"],
            "description": "Horizontal alignment"
          }
        },
        "additionalProperties": false
      },
      "KeyboardSettings": {
        "type": "object",
        "description": "Keyboard interaction settings",
        "properties": {
          "allowArrowKeys": {
            "type": "boolean",
            "description": "Enable left/right arrow keys for step navigation",
            "default": true
          },
          "allowEscapeKey": {
            "type": "boolean",
            "description": "Enable escape key for tour exit",
            "default": true
          }
        },
        "additionalProperties": false
      },
      "ExitSettings": {
        "type": "object",
        "description": "Exit behavior settings",
        "properties": {
          "requireConfirmation": {
            "type": "boolean",
            "description": "Whether to show confirmation dialog before exit",
            "default": false
          },
          "confirmationMessage": {
            "type": "string",
            "description": "Custom message for exit confirmation dialog",
            "default": "Are you sure you want to exit the tour?"
          }
        },
        "if": {
          "properties": {
            "requireConfirmation": { "const": true }
          }
        },
        "then": {
          "required": ["confirmationMessage"]
        },
        "additionalProperties": false
      },
      "VisualSettings": {
        "type": "object",
        "description": "Visual appearance settings",
        "properties": {
          "enableHighlightOverlay": {
            "type": "boolean",
            "description": "Controls whether to dim the background and highlight the target element",
            "default": false
          }
        },
        "additionalProperties": false
      },
      "CustomArrowImageOptions": {
        "type": "object",
        "required": ["src"],
        "properties": {
          "src": {
            "type": "string",
            "description": "Source URL for the arrow image"
          },
          "alt": {
            "type": "string",
            "description": "Alternative text for accessibility"
          },
          "width": {
            "type": "number",
            "description": "Width of the arrow element in pixels"
          },
          "height": {
            "type": "number",
            "description": "Height of the arrow element in pixels"
          },
          "offset": {
            "$ref": "#/definitions/OffsetValue",
            "description": "Offset configuration for the arrow position"
          },
          "placementToTarget": {
            "type": "string",
            "enum": ["top", "right", "bottom", "left", "top-start", "top-end", "bottom-start", "bottom-end", "left-start", "left-end", "right-start", "right-end"],
            "description": "Placement of the arrow relative to the target element"
          }
        },
        "additionalProperties": false
      },
      "OffsetValue": {
        "oneOf": [
          {
            "type": "number",
            "description": "Simple numeric offset value"
          },
          {
            "type": "object",
            "properties": {
              "mainAxis": {
                "type": "number",
                "description": "The axis that runs along the side of the floating element. Represents the distance (gutter or margin) between the reference and floating element.",
                "default": 0
              },
              "crossAxis": {
                "type": "number",
                "description": "The axis that runs along the alignment of the floating element. Represents the skidding between the reference and floating element.",
                "default": 0
              },
              "alignmentAxis": {
                "oneOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The same axis as 'crossAxis' but applies only to aligned placements and inverts the 'end' alignment. When set to a number, it overrides the crossAxis value. A positive number will move the floating element in the direction of the opposite edge to the one that is aligned, while a negative number the reverse.",
                "default": null
              }
            },
            "additionalProperties": false
          }
        ],
        "description": "Configures positioning offset as either a number or detailed axis-based configuration"
      }
    },
    "additionalProperties": false
  }
  