{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://showbridge.io/processors.schema.json",
  "title": "Processors",
  "description": "processor configurations",
  "type": "array",
  "items": {
    "oneOf": [
      {
        "type": "object",
        "title": "Decode ArtNet Packet",
        "properties": {
          "type": {
            "type": "string",
            "const": "artnet.packet.decode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Encode ArtNet Packet",
        "properties": {
          "type": {
            "type": "string",
            "const": "artnet.packet.encode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Debug Log",
        "properties": {
          "type": {
            "type": "string",
            "const": "debug.log"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Filter by Expr expression",
        "properties": {
          "type": {
            "type": "string",
            "const": "filter.expr"
          },
          "params": {
            "type": "object",
            "properties": {
              "expression": {
                "title": "Expression",
                "type": "string"
              }
            },
            "required": ["expression"],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Filter by Regex",
        "properties": {
          "type": {
            "type": "string",
            "const": "filter.regex"
          },
          "params": {
            "type": "object",
            "properties": {
              "pattern": {
                "title": "Pattern",
                "type": "string"
              }
            },
            "required": ["pattern"],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Parse Float",
        "properties": {
          "type": {
            "type": "string",
            "const": "float.parse"
          },
          "params": {
            "type": "object",
            "properties": {
              "bitSize": {
                "title": "Bit Size",
                "type": "integer",
                "enum": [32, 64],
                "default": 64
              }
            },
            "additionalProperties": false
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Create FreeD",
        "properties": {
          "type": {
            "type": "string",
            "const": "freed.create"
          },
          "params": {
            "type": "object",
            "properties": {
              "id": {
                "title": "Camera ID",
                "type": "string"
              },
              "pan": {
                "title": "Pan",
                "type": "string"
              },
              "tilt": {
                "title": "Tilt",
                "type": "string"
              },
              "roll": {
                "title": "Roll",
                "type": "string"
              },
              "posX": {
                "title": "Position X",
                "type": "string"
              },
              "posY": {
                "title": "Position Y",
                "type": "string"
              },
              "posZ": {
                "title": "Position Z",
                "type": "string"
              },
              "zoom": {
                "title": "Zoom",
                "type": "string"
              },
              "focus": {
                "title": "Focus",
                "type": "string"
              }
            },
            "required": [
              "id",
              "pan",
              "tilt",
              "roll",
              "posX",
              "posY",
              "posZ",
              "zoom",
              "focus"
            ],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Decode FreeD",
        "properties": {
          "type": {
            "type": "string",
            "const": "freed.decode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Encode FreeD",
        "properties": {
          "type": {
            "type": "string",
            "const": "freed.encode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Do HTTP Request",
        "properties": {
          "type": {
            "type": "string",
            "const": "http.request.do"
          },
          "params": {
            "type": "object",
            "properties": {
              "method": {
                "title": "HTTP Method",
                "type": "string",
                "enum": ["GET", "POST"]
              },
              "url": {
                "title": "URL",
                "type": "string"
              }
            },
            "required": ["method", "url"],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Create HTTP Response",
        "properties": {
          "type": {
            "type": "string",
            "const": "http.response.create"
          },
          "params": {
            "type": "object",
            "properties": {
              "status": {
                "title": "Status Code",
                "type": "integer"
              },
              "body": {
                "title": "Body",
                "type": "string"
              }
            },
            "required": ["status", "body"],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Parse Int",
        "properties": {
          "type": {
            "type": "string",
            "const": "int.parse"
          },
          "params": {
            "type": "object",
            "properties": {
              "base": {
                "title": "Base",
                "type": "integer",
                "enum": [0, 2, 8, 10, 16],
                "default": 10
              },
              "bitSize": {
                "title": "Bit Size",
                "type": "integer",
                "enum": [0, 8, 16, 32, 64],
                "default": 64
              }
            },
            "additionalProperties": false
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Random Int",
        "properties": {
          "type": {
            "type": "string",
            "const": "int.random"
          },
          "params": {
            "type": "object",
            "properties": {
              "min": {
                "title": "Minimum",
                "type": "integer"
              },
              "max": {
                "title": "Maximum",
                "type": "integer"
              }
            },
            "required": ["min", "max"],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Scale Int",
        "properties": {
          "type": {
            "type": "string",
            "const": "int.scale"
          },
          "params": {
            "type": "object",
            "properties": {
              "inMin": {
                "title": "Input Minimum",
                "type": "integer"
              },
              "inMax": {
                "title": "Input Maximum",
                "type": "integer"
              },
              "outMin": {
                "title": "Output Minimum",
                "type": "integer"
              },
              "outMax": {
                "title": "Output Maximum",
                "type": "integer"
              }
            },
            "required": ["inMin", "inMax", "outMin", "outMax"],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Decode JSON",
        "properties": {
          "type": {
            "type": "string",
            "const": "json.decode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Encode JSON",
        "properties": {
          "type": {
            "type": "string",
            "const": "json.encode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Create MIDI Message",
        "properties": {
          "type": {
            "type": "string",
            "const": "midi.message.create"
          },
          "params": {
            "type": "object",
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "title": "MIDI Message Type",
                    "type": "string",
                    "enum": ["NoteOn", "noteon", "note_on"]
                  },
                  "channel": {
                    "title": "Channel",
                    "type": "string"
                  },
                  "note": {
                    "title": "Note",
                    "type": "string"
                  },
                  "velocity": {
                    "title": "Velocity",
                    "type": "string"
                  }
                },
                "required": ["type", "channel", "note", "velocity"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "title": "MIDI Message Type",
                    "type": "string",
                    "enum": ["NoteOff", "noteoff", "note_off"]
                  },
                  "channel": {
                    "title": "Channel",
                    "type": "string"
                  },
                  "note": {
                    "title": "Note",
                    "type": "string"
                  },
                  "velocity": {
                    "title": "Velocity",
                    "type": "string"
                  }
                },
                "required": ["type", "channel", "note", "velocity"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "title": "MIDI Message Type",
                    "type": "string",
                    "enum": ["ControlChange", "controlchange", "control_change"]
                  },
                  "channel": {
                    "title": "Channel",
                    "type": "string"
                  },
                  "control": {
                    "title": "Control",
                    "type": "string"
                  },
                  "value": {
                    "title": "Value",
                    "type": "string"
                  }
                },
                "required": ["type", "channel", "control", "value"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "title": "MIDI Message Type",
                    "type": "string",
                    "enum": ["ProgramChange", "programchange", "program_change"]
                  },
                  "channel": {
                    "title": "Channel",
                    "type": "string"
                  },
                  "program": {
                    "title": "Program",
                    "type": "string"
                  }
                },
                "required": ["type", "channel", "program"],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Decode MIDI Message",
        "properties": {
          "type": {
            "type": "string",
            "const": "midi.message.decode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Encode MIDI Message",
        "properties": {
          "type": {
            "type": "string",
            "const": "midi.message.encode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Unpack MIDI Message",
        "properties": {
          "type": {
            "type": "string",
            "const": "midi.message.unpack"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Create MQTT Message",
        "properties": {
          "type": {
            "type": "string",
            "const": "mqtt.message.create"
          },
          "params": {
            "type": "object",
            "properties": {
              "topic": {
                "title": "Topic",
                "type": "string"
              },
              "qos": {
                "title": "QoS",
                "type": "number"
              },
              "retained": {
                "title": "Retained",
                "type": "boolean"
              },
              "payload": {
                "title": "Payload",
                "type": "string"
              }
            },
            "required": ["topic", "qos", "retained", "payload"],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Encode MQTT Message",
        "properties": {
          "type": {
            "type": "string",
            "const": "mqtt.message.encode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Create NATS Message",
        "properties": {
          "type": {
            "type": "string",
            "const": "nats.message.create"
          },
          "params": {
            "type": "object",
            "properties": {
              "subject": {
                "title": "Subject",
                "type": "string"
              },
              "payload": {
                "title": "Payload",
                "type": "string"
              }
            },
            "required": ["subject", "payload"],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Create OSC Message",
        "properties": {
          "type": {
            "type": "string",
            "const": "osc.message.create"
          },
          "params": {
            "type": "object",
            "properties": {
              "address": {
                "title": "Address",
                "type": "string"
              },
              "args": {
                "title": "Arguments",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "types": {
                "title": "Argument Types",
                "type": "string"
              }
            },
            "required": ["address"],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Decode OSC Message",
        "properties": {
          "type": {
            "type": "string",
            "const": "osc.message.decode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Encode OSC Message",
        "properties": {
          "type": {
            "type": "string",
            "const": "osc.message.encode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Router Input",
        "properties": {
          "type": {
            "type": "string",
            "const": "router.input"
          },
          "params": {
            "type": "object",
            "properties": {
              "source": {
                "title": "Source",
                "type": "string",
                "description": "source to report as to the router"
              }
            },
            "required": ["source"]
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Router Output",
        "properties": {
          "type": {
            "type": "string",
            "const": "router.output"
          },
          "params": {
            "type": "object",
            "properties": {
              "module": {
                "title": "Module ID",
                "type": "string",
                "description": "ID of module to send output to"
              }
            },
            "required": ["module"]
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Evaluate Expr expression",
        "properties": {
          "type": {
            "type": "string",
            "const": "script.expr"
          },
          "params": {
            "type": "object",
            "properties": {
              "expression": {
                "title": "Expression",
                "type": "string"
              }
            },
            "required": ["expression"],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Run JavaScript",
        "properties": {
          "type": {
            "type": "string",
            "const": "script.js"
          },
          "params": {
            "type": "object",
            "properties": {
              "program": {
                "title": "Program",
                "type": "string"
              }
            },
            "required": ["program"],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Run WASM Plugin",
        "properties": {
          "type": {
            "type": "string",
            "const": "script.wasm"
          },
          "params": {
            "type": "object",
            "properties": {
              "path": {
                "title": "Path",
                "type": "string"
              },
              "function": {
                "title": "Function",
                "type": "string",
                "default": "process"
              },
              "enableWasi": {
                "title": "Enable WASI",
                "type": "boolean",
                "default": false
              }
            },
            "required": ["path"],
            "additionalProperties": false
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Create String",
        "properties": {
          "type": {
            "type": "string",
            "const": "string.create"
          },
          "params": {
            "type": "object",
            "properties": {
              "template": {
                "title": "Template",
                "type": "string"
              }
            },
            "required": ["template"]
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Decode String",
        "properties": {
          "type": {
            "type": "string",
            "const": "string.decode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Encode String",
        "properties": {
          "type": {
            "type": "string",
            "const": "string.encode"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Split String",
        "properties": {
          "type": {
            "type": "string",
            "const": "string.split"
          },
          "params": {
            "type": "object",
            "properties": {
              "separator": {
                "title": "Separator",
                "type": "string"
              }
            },
            "required": ["separator"]
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Get Struct Field",
        "properties": {
          "type": {
            "type": "string",
            "const": "struct.field.get"
          },
          "params": {
            "type": "object",
            "properties": {
              "name": {
                "title": "Field Name",
                "type": "string"
              }
            },
            "required": ["name"]
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Get Struct Method",
        "properties": {
          "type": {
            "type": "string",
            "const": "struct.method.get"
          },
          "params": {
            "type": "object",
            "properties": {
              "name": {
                "title": "Method Name",
                "type": "string"
              }
            },
            "required": ["name"]
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Sleep",
        "properties": {
          "type": {
            "type": "string",
            "const": "time.sleep"
          },
          "params": {
            "type": "object",
            "properties": {
              "duration": {
                "title": "Duration",
                "type": "integer",
                "description": "Duration to sleep in milliseconds"
              }
            },
            "required": ["duration"]
          }
        },
        "required": ["type", "params"],
        "additionalProperties": false
      }
    ]
  }
}
