{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eagle-eye-networks/json-schema/eagle-eye-networks-port-patch-schema.json",
  "title": "PortPatch",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eagle-eye-networks-device-i-o-api-openapi.yml#/components/schemas/PortPatch",
  "oneOf": [
    {
      "$ref": "#/$defs/Port"
    },
    {
      "$ref": "#/$defs/PortOutputPatch"
    }
  ],
  "$defs": {
    "Port": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "readOnly": true,
          "description": "Unique ID for the port."
        },
        "enabled": {
          "type": "boolean",
          "description": "If the port is not enabled, no events will be created, and the icon will not show up in the live stream."
        },
        "name": {
          "type": "string",
          "description": "Human changeable name of the port, defaults to value of the id field.",
          "minLength": 1,
          "maxLength": 126
        },
        "type": {
          "type": "string",
          "readOnly": true,
          "description": "Denotes whether this is an input or output port.",
          "enum": [
            "input",
            "output"
          ]
        },
        "idleCircuitState": {
          "type": "string",
          "description": "Indicates the normal, inactive or idle, state of the connected circuit.\nPossible values:\n\n* `open`: means the port is \"off\" when in `idle` state (open circuit; has no voltage), and the port state being `active` means it is turned \"on\" (circuit is closed; has voltage).\n* `closed`: means the port is \"on\" when in `idle` state (closed circuit; has voltage), and the port state being active means it is turned \"off\" (open circuit; has no voltage).\n",
          "enum": [
            "open",
            "closed"
          ]
        },
        "rules": {
          "$ref": "#/$defs/PortRules"
        }
      }
    },
    "PortOutputPatch": {
      "allOf": [
        {
          "$ref": "#/$defs/Port"
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "$ref": "#/$defs/PortStatusPatch"
            }
          }
        }
      ]
    },
    "PortRules": {
      "type": "object",
      "properties": {
        "recordOnActive": {
          "type": "boolean",
          "description": "If this value is set to true, the port is an input and the device can record video, then the bridge should start recording when the port becomes active."
        },
        "icon": {
          "type": [
            "string",
            "null"
          ],
          "description": "If enabled, the given icon is shown for all livestreams of the camera and highlighted when the port is active. For ports of \"output\" type the icon can then also be clicked to change the state of the camera.",
          "enum": [
            "siren",
            "light",
            "dot",
            "door",
            "bell"
          ]
        },
        "iconEnabled": {
          "type": "boolean",
          "description": "Inidicates if the icon should be visible on all livestreams."
        }
      }
    },
    "PortStatusPatch": {
      "type": "object",
      "properties": {
        "state": {
          "type": "string",
          "description": "Set the state of the connected circuit.",
          "enum": [
            "active",
            "idle"
          ]
        },
        "durationSeconds": {
          "type": "integer",
          "description": "Number of seconds to hold the circuit in the given state.  If not provided, the state will hold indefinitely.\n",
          "minimum": 1,
          "maximum": 3600000
        }
      }
    }
  }
}