{
    "type": "object",
    "properties": {
        "script_path": {
            "type": "string",
            "description": "Path to the script or flow to execute when triggered"
        },
        "is_flow": {
            "type": "boolean",
            "description": "True if script_path points to a flow, false if it points to a script"
        },
        "labels": {
            "type": "array",
            "items": {
                "type": "string"
            },
            "default": []
        },
        "draft_only": {
            "description": "True when this row is a per-user draft with no deployed\ntrigger at the same path. Set by list endpoints when\n`include_draft_only=true` synthesizes the row from the\ndraft. Frontend renders a \"Draft\" badge.\n",
            "type": "boolean"
        },
        "is_draft": {
            "description": "True when the authed user has a per-user draft at this path\n(over a deployed row or a synthesized draft-only row).\nFrontend appends a `*` to the displayed name.\n",
            "type": "boolean"
        },
        "mqtt_resource_path": {
            "type": "string",
            "description": "Path to the MQTT resource containing broker connection configuration"
        },
        "subscribe_topics": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "qos": {
                        "type": "string",
                        "enum": [
                            "qos0",
                            "qos1",
                            "qos2"
                        ]
                    },
                    "topic": {
                        "type": "string"
                    }
                },
                "required": [
                    "qos",
                    "topic"
                ]
            },
            "description": "Array of MQTT topics to subscribe to, each with topic name and QoS level"
        },
        "v3_config": {
            "type": "object",
            "properties": {
                "clean_session": {
                    "type": "boolean"
                }
            },
            "nullable": true,
            "description": "MQTT v3 specific configuration (clean_session)"
        },
        "v5_config": {
            "type": "object",
            "properties": {
                "clean_start": {
                    "type": "boolean"
                },
                "topic_alias_maximum": {
                    "type": "number"
                },
                "session_expiry_interval": {
                    "type": "number"
                }
            },
            "nullable": true,
            "description": "MQTT v5 specific configuration (clean_start, topic_alias_maximum, session_expiry_interval)"
        },
        "client_id": {
            "type": "string",
            "nullable": true,
            "description": "MQTT client ID for this connection"
        },
        "client_version": {
            "type": "string",
            "enum": [
                "v3",
                "v5",
                null
            ],
            "nullable": true,
            "description": "MQTT protocol version ('v3' or 'v5')"
        },
        "error_handler_path": {
            "type": "string",
            "description": "Path to a script or flow to run when the triggered job fails"
        },
        "error_handler_args": {
            "type": "object",
            "description": "Arguments to pass to the error handler",
            "additionalProperties": true
        },
        "retry": {
            "type": "object",
            "description": "Retry configuration for failed executions",
            "properties": {
                "constant": {
                    "type": "object",
                    "description": "Retry with constant delay between attempts",
                    "properties": {
                        "attempts": {
                            "type": "integer",
                            "description": "Number of retry attempts"
                        },
                        "seconds": {
                            "type": "integer",
                            "description": "Seconds to wait between retries"
                        }
                    }
                },
                "exponential": {
                    "type": "object",
                    "description": "Retry with exponential backoff (delay doubles each time)",
                    "properties": {
                        "attempts": {
                            "type": "integer",
                            "description": "Number of retry attempts"
                        },
                        "multiplier": {
                            "type": "integer",
                            "description": "Multiplier for exponential backoff"
                        },
                        "seconds": {
                            "type": "integer",
                            "minimum": 1,
                            "description": "Initial delay in seconds"
                        },
                        "random_factor": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "description": "Random jitter percentage (0-100) to avoid thundering herd"
                        }
                    }
                },
                "retry_if": {
                    "type": "object",
                    "description": "Conditional retry based on error or result",
                    "properties": {
                        "expr": {
                            "type": "string",
                            "description": "JavaScript expression that returns true to retry. Has access to 'result' and 'error' variables"
                        }
                    },
                    "required": [
                        "expr"
                    ]
                }
            }
        }
    },
    "required": [
        "script_path",
        "is_flow",
        "subscribe_topics",
        "mqtt_resource_path"
    ]
}
