{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://showbridge.io/modules.schema.json",
  "title": "Modules",
  "description": "module configurations",
  "type": "array",
  "items": {
    "oneOf": [
      {
        "type": "object",
        "title": "HTTP Server",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "http.server"
          },
          "params": {
            "type": "object",
            "properties": {
              "port": {
                "title": "Port",
                "type": "integer",
                "minimum": 1024,
                "maximum": 65535
              }
            },
            "required": ["port"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Interval",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "time.interval"
          },
          "params": {
            "type": "object",
            "properties": {
              "duration": {
                "title": "Duration",
                "type": "integer",
                "description": "Interval duration in milliseconds"
              }
            },
            "required": ["duration"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Timer",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "time.timer"
          },
          "params": {
            "type": "object",
            "properties": {
              "duration": {
                "title": "Duration",
                "type": "integer",
                "description": "Timer duration in milliseconds"
              }
            },
            "required": ["duration"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "MIDI Input",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "midi.input"
          },
          "params": {
            "type": "object",
            "properties": {
              "port": {
                "title": "Port",
                "type": "string"
              }
            },
            "required": ["port"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "MIDI Output",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "midi.output"
          },
          "params": {
            "type": "object",
            "properties": {
              "port": {
                "title": "Port",
                "type": "string"
              }
            },
            "required": ["port"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "MQTT Client",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "mqtt.client"
          },
          "params": {
            "type": "object",
            "properties": {
              "broker": {
                "title": "Broker URL",
                "type": "string"
              },
              "topic": {
                "title": "Topic",
                "type": "string"
              },
              "clientId": {
                "title": "Client ID",
                "type": "string"
              }
            },
            "required": ["broker", "topic", "clientId"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "NATS Client",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "nats.client"
          },
          "params": {
            "type": "object",
            "properties": {
              "url": {
                "title": "NATS Server URL",
                "type": "string"
              },
              "subject": {
                "title": "Subject",
                "type": "string"
              }
            },
            "required": ["url", "subject"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "NATS Server",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "nats.server"
          },
          "params": {
            "type": "object",
            "properties": {
              "ip": {
                "title": "IP",
                "type": "string",
                "default": "0.0.0.0"
              },
              "port": {
                "title": "Port",
                "type": "integer",
                "minimum": 1024,
                "maximum": 65535,
                "default": 4222
              }
            },
            "required": [],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "PSN Client",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "psn.client"
          }
        },
        "required": ["id", "type"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "RedisClientModule",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "redis.client"
          },
          "params": {
            "type": "object",
            "properties": {
              "host": {
                "type": "string"
              },
              "port": {
                "type": "integer",
                "minimum": 1,
                "maximum": 65535
              }
            },
            "required": ["host", "port"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "Serial Client",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "serial.client"
          },
          "params": {
            "type": "object",
            "properties": {
              "port": {
                "title": "Port",
                "type": "string"
              },
              "baudRate": {
                "title": "Baud Rate",
                "type": "integer"
              }
            },
            "required": ["port", "baudRate"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "SIP Call Server",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "sip.call.server"
          },
          "params": {
            "type": "object",
            "properties": {
              "ip": {
                "title": "IP",
                "type": "string",
                "default": "0.0.0.0"
              },
              "port": {
                "title": "Port",
                "type": "integer",
                "minimum": 1024,
                "maximum": 65535,
                "default": 5060
              },
              "transport": {
                "title": "Transport",
                "type": "string",
                "enum": ["udp", "tcp", "ws", "udp4", "tcp4"],
                "default": "udp"
              },
              "userAgent": {
                "title": "User Agent",
                "type": "string",
                "default": "showbridge"
              }
            },
            "required": [],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "SIP DTMF Server",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "sip.dtmf.server"
          },
          "params": {
            "type": "object",
            "properties": {
              "ip": {
                "title": "IP",
                "type": "string",
                "default": "0.0.0.0"
              },
              "port": {
                "title": "Port",
                "type": "integer",
                "minimum": 1024,
                "maximum": 65535,
                "default": 5060
              },
              "transport": {
                "title": "Transport",
                "type": "string",
                "enum": ["udp", "tcp", "ws", "udp4", "tcp4"],
                "default": "udp"
              },
              "userAgent": {
                "title": "User Agent",
                "type": "string",
                "default": "showbridge"
              },
              "separator": {
                "title": "DTMF Separator",
                "type": "string",
                "minLength": 1,
                "maxLength": 1
              }
            },
            "required": ["separator"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "TCP Client",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "net.tcp.client"
          },
          "params": {
            "type": "object",
            "properties": {
              "host": {
                "title": "Host",
                "type": "string"
              },
              "port": {
                "title": "Port",
                "type": "integer",
                "minimum": 1,
                "maximum": 65535
              },
              "framing": {
                "title": "Framing Method",
                "type": "string",
                "enum": ["LF", "CR", "CRLF", "SLIP", "RAW"]
              }
            },
            "required": ["host", "port", "framing"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "TCP Server",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "net.tcp.server"
          },
          "params": {
            "type": "object",
            "properties": {
              "ip": {
                "title": "IP",
                "type": "string",
                "default": "0.0.0.0"
              },
              "port": {
                "title": "Port",
                "type": "integer",
                "minimum": 1024,
                "maximum": 65535
              },
              "framing": {
                "title": "Framing Method",
                "type": "string",
                "enum": ["LF", "CR", "CRLF", "SLIP", "RAW"]
              }
            },
            "required": ["port", "framing"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "UDP Client",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "net.udp.client"
          },
          "params": {
            "type": "object",
            "properties": {
              "host": {
                "title": "Host",
                "type": "string"
              },
              "port": {
                "title": "Port",
                "type": "integer",
                "minimum": 1,
                "maximum": 65535
              }
            },
            "required": ["host", "port"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "UDP Multicast",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "net.udp.multicast"
          },
          "params": {
            "type": "object",
            "properties": {
              "ip": {
                "title": "IP",
                "type": "string"
              },
              "port": {
                "title": "Port",
                "type": "integer",
                "minimum": 1024,
                "maximum": 65535
              }
            },
            "required": ["ip", "port"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "UDP Server",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "const": "net.udp.server"
          },
          "params": {
            "type": "object",
            "properties": {
              "ip": {
                "title": "IP",
                "type": "string",
                "default": "0.0.0.0"
              },
              "port": {
                "title": "Port",
                "type": "integer",
                "minimum": 1024,
                "maximum": 65535
              }
            },
            "required": ["port"],
            "additionalProperties": false
          }
        },
        "required": ["id", "type", "params"],
        "additionalProperties": false
      }
    ]
  }
}
