{
    "$schema": "https://json-schema.org/draft-07/schema#",
    "$id": "https://schemas.boomack.com/client/v0.15/sequence-step",

    "title": "Boomack Sequence Step",
    "description": "A step in a Boomack Sequence.",

    "$defs": {

        "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9-_]+$"
        },

        "panelProp": {
            "title": "Panel ID",
            "description": "The ID of the new or existing panel",
            "$ref": "#/$defs/id"
        },

        "labelProp": {
            "title": "A step label",
            "description": "An optional string to identify the step by",
            "$ref": "#/$defs/id"
        },

        "tagsProp": {
            "description": "A list of tags for the sequence step",
            "type": "array",
            "items": {
                "type": "string"
            }
        }

    },

    "anyOf": [
        {
            "title": "Add/Update Panel",
            "description": "Create a panel or update the layout of a panel",
            "type": "object",
            "properties": {
                "type": {
                    "title": "Step Type",
                    "description": "The type of the sequence step",
                    "type": "string",
                    "const": "update-panel"
                },
                "label": { "$ref": "#/$defs/labelProp" },
                "tags": { "$ref": "#/$defs/tagsProp" },
                "panel": { "$ref": "#/$defs/panelProp" },
                "layout": {
                    "title": "Panel Layout",
                    "description": "The layout for the panel",
                    "anyOf": [
                        { "$ref": "https://schemas.boomack.com/server/v0.14/panel-layout.json" },
                        {
                            "title": "Panel Layout Reference",
                            "description": "A URL or relative path to a JSON or YAML file with a panel layout.",
                            "type": "string",
                            "format": "uri"
                        }
                    ]
                }
            },
            "required": ["type", "layout"]
        },
        {
            "title": "Delete Panel",
            "description": "Delete an existing panel",
            "type": "object",
            "properties": {
                "type": {
                    "title": "Step Type",
                    "description": "The type of the sequence step",
                    "type": "string",
                    "const": "delete-panel"
                },
                "label": { "$ref": "#/$defs/labelProp" },
                "tags": { "$ref": "#/$defs/tagsProp" },
                "panel": { "$ref": "#/$defs/panelProp" }
            },
            "required": ["type"]
        },
        {
            "title": "Display Request",
            "description": "Display one or multiple media items",
            "type": "object",
            "properties": {
                "type": {
                    "title": "Step Type",
                    "description": "The type of the sequence step",
                    "type": "string",
                    "const": "display"
                },
                "label": { "$ref": "#/$defs/labelProp" },
                "tags": { "$ref": "#/$defs/tagsProp" },
                "panel": { "$ref": "#/$defs/panelProp" },
                "request": {
                    "title": "Display Request",
                    "description": "A Display Request.",
                    "anyOf": [
                        { "$ref": "https://schemas.boomack.com/server/v0.14/display-request.json" },
                        {
                            "title": "Display Request Reference",
                            "description": "A URL or relative path to a JSON or YAML file with a display request.",
                            "type": "string",
                            "format": "uri"
                        }
                    ]
                },
                "requests": {
                    "title": "Display Requests",
                    "description": "An array of Display Requests.",
                    "type": "array",
                    "items": {
                        "anyOf": [
                            { "$ref": "https://schemas.boomack.com/server/v0.14/display-request.json" },
                            {
                                "title": "Display Request Reference",
                                "description": "A URL or relative path to a JSON or YAML file with a display request.",
                                "type": "string",
                                "format": "uri"
                            }
                        ]
                    }
                }
            },
            "required": ["type"]
        },
        {
            "title": "Clear Panel Request",
            "description": "Clear all or a selection of slots in the target panel",
            "type": "object",
            "properties": {
                "type": {
                    "title": "Step Type",
                    "description": "The type of the sequence step",
                    "type": "string",
                    "const": "clear-panel"
                },
                "label": { "$ref": "#/$defs/labelProp" },
                "tags": { "$ref": "#/$defs/tagsProp" },
                "panel": { "$ref": "#/$defs/panelProp" },
                "slots": {
                    "title": "Slot IDs",
                    "description": "The IDs of the slots to clear",
                    "type": "array",
                    "items": { "$ref": "#/$defs/id" }
                }
            },
            "required": ["type"]
        },
        {
            "title": "Clear Slot Request",
            "description": "Clear the target slot",
            "type": "object",
            "properties": {
                "type": {
                    "title": "Step Type",
                    "description": "The type of the sequence step",
                    "type": "string",
                    "const": "clear-slot"
                },
                "label": { "$ref": "#/$defs/labelProp" },
                "tags": { "$ref": "#/$defs/tagsProp" },
                "panel": { "$ref": "#/$defs/panelProp" },
                "slot": {
                    "title": "Slot ID",
                    "description": "The ID of the slot to clear",
                    "$ref": "#/$defs/id"
                }
            },
            "required": ["type"]
        }
    ]
}