{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eagle-eye-networks/json-schema/eagle-eye-networks-api-switch-with-includes-schema.json",
  "title": "ApiSwitchWithIncludes",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eagle-eye-networks-switches-api-openapi.yml#/components/schemas/ApiSwitchWithIncludes",
  "allOf": [
    {
      "$ref": "#/$defs/ApiSwitchMain"
    },
    {
      "$ref": "#/$defs/ApiSwitchIncludes"
    },
    {
      "type": "object"
    }
  ],
  "$defs": {
    "ApiAdapterInfo": {
      "type": "object",
      "properties": {
        "macAddress": {
          "$ref": "#/$defs/MacAddress"
        },
        "ipAddress": {
          "$ref": "#/$defs/IpAddress"
        }
      }
    },
    "ApiFirmware": {
      "type": "object",
      "x-jsoninclude-nonnull-annotation": true,
      "properties": {
        "currentVersion": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "ApiNetworkInfo": {
      "type": "object",
      "x-jsoninclude-nonnull-annotation": true,
      "properties": {
        "globalIP": {
          "$ref": "#/$defs/IpAddress"
        },
        "adapters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ApiAdapterInfo"
          }
        }
      }
    },
    "ApiSwitchIncludes": {
      "type": "object",
      "properties": {
        "status": {
          "$ref": "#/$defs/DeviceStatus"
        },
        "statusV2": {
          "$ref": "#/$defs/DeviceStatusV2"
        },
        "notes": {
          "type": "string",
          "x-jsoninclude-nonnull-annotation": true
        },
        "ports": {
          "type": "array",
          "x-jsoninclude-nonnull-annotation": true,
          "description": "List of ports of the switch and details about each port and what is possibly connected to it.",
          "items": {
            "$ref": "#/$defs/ApiSwitchPort"
          }
        },
        "networkInfo": {
          "$ref": "#/$defs/ApiNetworkInfo"
        },
        "firmware": {
          "$ref": "#/$defs/ApiFirmware"
        },
        "visibleByBridges": {
          "type": "array",
          "x-jsoninclude-nonnull-annotation": true,
          "items": {
            "$ref": "#/$defs/BridgeId2"
          }
        }
      }
    },
    "ApiSwitchMain": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Unique switch identifier"
        },
        "accountId": {
          "type": "string",
          "description": "Account ID."
        },
        "name": {
          "$ref": "#/$defs/Name1"
        },
        "bridgeId": {
          "$ref": "#/$defs/BridgeId2"
        },
        "portCount": {
          "type": "integer"
        }
      },
      "required": [
        "id",
        "name",
        "accountId"
      ]
    },
    "ApiSwitchPort": {
      "type": "object",
      "x-jsoninclude-nonnull-annotation": true,
      "properties": {
        "id": {
          "type": "integer",
          "description": "Port identifier, unique for the given switch"
        },
        "enabled": {
          "type": "boolean",
          "description": "Indicates whether the port is on (true) or off (false)"
        },
        "power": {
          "type": "number",
          "description": "Power in Watts that this port is drawing"
        },
        "detectedDeviceCount": {
          "type": "integer",
          "description": "Number of devices connected to the port. If a single device has been detected, the Mac address and possibly the IP Address are returned.\n"
        },
        "devices": {
          "type": "array",
          "description": "List of devices that are known to be connected to the port.",
          "items": {
            "$ref": "#/$defs/DetectedDevice"
          }
        }
      }
    },
    "BridgeId2": {
      "type": "string",
      "description": "The bridge a switch is connected to.\n"
    },
    "DetectedDevice": {
      "type": "object",
      "description": "Describes a device detected behind a port.",
      "properties": {
        "macAddress": {
          "allOf": [
            {
              "$ref": "#/$defs/MacAddress1"
            },
            {
              "description": "MAC address behind the port."
            }
          ]
        },
        "ipAddress": {
          "allOf": [
            {
              "$ref": "#/$defs/IpAddress1"
            },
            {
              "description": "IP Address found using ARP for the given MAC address."
            }
          ]
        },
        "guid": {
          "type": "string",
          "format": "uuid",
          "description": "GUID of the device that corresponds to the MAC or IP connected to the port."
        },
        "esn": {
          "type": "string",
          "description": "Esn of the device that corresponds to the MAC or IP connected to the port."
        },
        "deviceName": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name of the device that corresponds to the MAC or IP connected to the port. The value is null if no device is connected to the port."
        },
        "deviceId": {
          "type": [
            "string",
            "null"
          ],
          "description": "Id of the device that corresponds to the MAC or IP connected to the port. The value is null if no device is connected to the port."
        },
        "deviceType": {
          "type": [
            "string",
            "null"
          ],
          "description": "Type of the device that corresponds to the MAC or IP connected to the port. The value is null if no device is connected to the port. new devices might be added in the future.\n",
          "enum": [
            "camera",
            "speaker",
            "bridge",
            "multiCamera"
          ]
        }
      }
    },
    "DeviceCommonStatus": {
      "description": "Indicates the operational status of the device. The statuses defined here should be in sync with the DeviceStatus schema.\n  * `operational`: The device is online and operational.\n  * `error`: Device not working (requires error details).\n  * `disabled`: Operational but intentionally not recording telemetry\n  * `unreachable`: The device is not reachable (e.g., offline, out of service).\n  * `unknown`: The device state is unknown for some reason.\n  * `initializing`: The device is in the process of initializing.\n",
      "type": "string",
      "enum": [
        "operational",
        "error",
        "disabled",
        "unreachable",
        "unknown",
        "initializing"
      ]
    },
    "DeviceConnectionStatus": {
      "type": "string",
      "description": "Indicates the connection status of the device:\n  * `online`: The device is online and operational.\n  * `deviceOffline`: The device is offline.\n  * `invalidCredentials`: The known credentials for this device, including the default credentials, are invalid. This is causing the device to appear offline.\n  * `bridgeOffline`: The bridge that connects this device to the cloud is offline. However, both the device and the bridge may still be operational locally, even though the cloud has no visibility into their status.\n  * `off`: The device is online, but has been turned off by the user.\n  * `error`: The device is offline due to some problem that has not been described by any of the other statuses.\n  * `busy`: The device is currently busy and unavailable for other operations.\n  * `unknown`: The device state is unknown for some reason.\n",
      "enum": [
        "online",
        "deviceOffline",
        "invalidCredentials",
        "bridgeOffline",
        "off",
        "error",
        "busy",
        "unknown"
      ]
    },
    "DeviceErrorStatus": {
      "description": "Indicates the detailed error status of a device, grouped by device type:\nONVIF Camera / RTSP Camera / Multicamera:\n  * `generalDeviceError`: Camera error\n  * `networkError`: Network error\n  * `invalidCredentials`: Invalid credentials\n  * `deviceSupportIssue`: Device support issue\n  * `queuedForConfiguration`: Queued for configuration\n  * `configurationInProgress`: Configuration in progress\n  * `deviceDisabled`: Device is turned off\n  * `disconnectedFromBridge`: Disconnected from bridge\n\nAnalog Camera:\n  * `analogNoPower`: Power loss detected\n  * `analogBadSignal`: Signal quality issue\n  * `analogIncompatibleSignal`: Incompatible signal\n  * `analogNoSignal`: No signal\n  * `disconnectedFromBridge`: Disconnected from bridge\n  * `deviceDisabled`: Device is turned off\n\nManaged Switch:\n  * `deviceSupportIssue`: Switch support issue\n  * `disconnectedFromBridge`: Disconnected from bridge\n",
      "x-een-device-type-error-status-mapping": {
        "onvifCamera": [
          "generalDeviceError",
          "networkError",
          "invalidCredentials",
          "deviceSupportIssue",
          "queuedForConfiguration",
          "configurationInProgress",
          "deviceDisabled",
          "disconnectedFromBridge"
        ],
        "rtspCamera": [
          "generalDeviceError",
          "networkError",
          "invalidCredentials",
          "deviceSupportIssue",
          "queuedForConfiguration",
          "configurationInProgress",
          "deviceDisabled",
          "disconnectedFromBridge"
        ],
        "analogCamera": [
          "analogNoPower",
          "analogBadSignal",
          "analogIncompatibleSignal",
          "analogNoSignal",
          "disconnectedFromBridge",
          "deviceDisabled"
        ],
        "multiCamera": [
          "generalDeviceError",
          "networkError",
          "invalidCredentials",
          "deviceSupportIssue",
          "queuedForConfiguration",
          "configurationInProgress",
          "deviceDisabled",
          "disconnectedFromBridge"
        ],
        "managedSwitch": [
          "deviceSupportIssue",
          "disconnectedFromBridge"
        ]
      },
      "type": "string",
      "enum": [
        "disconnectedFromBridge",
        "generalDeviceError",
        "networkError",
        "invalidCredentials",
        "deviceSupportIssue",
        "queuedForConfiguration",
        "configurationInProgress",
        "deviceDisabled",
        "analogNoPower",
        "analogBadSignal",
        "analogIncompatibleSignal",
        "analogNoSignal"
      ]
    },
    "DeviceStatus": {
      "description": "Indicates various aspects of the device's status. The statuses defined here should be in sync with the events schema defined for the Device Cloud Status Update.",
      "type": "object",
      "x-jsoninclude-nonnull-annotation": true,
      "properties": {
        "connectionStatus": {
          "$ref": "#/$defs/DeviceConnectionStatus"
        }
      }
    },
    "DeviceStatusV2": {
      "description": "Status as reported by the edge device.",
      "type": "object",
      "x-jsoninclude-nonnull-annotation": true,
      "properties": {
        "cloudConnectionStatus": {
          "$ref": "#/$defs/deviceCloudConnectionStatusV2"
        },
        "edgeReportedDeviceStatus": {
          "$ref": "#/$defs/DeviceCommonStatus"
        },
        "deviceSpecificError": {
          "$ref": "#/$defs/DeviceErrorStatus"
        }
      },
      "required": [
        "cloudConnectionStatus",
        "edgeReportedDeviceStatus"
      ]
    },
    "IpAddress": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^(?:25[0-5]|2[0-4]\\d|[0-1]?\\d{1,2})(?:\\.(?:25[0-5]|2[0-4]\\d|[0-1]?\\d{1,2})){3}$"
    },
    "IpAddress1": {
      "type": "string",
      "pattern": "^(?:25[0-5]|2[0-4]\\d|[0-1]?\\d{1,2})(?:\\.(?:25[0-5]|2[0-4]\\d|[0-1]?\\d{1,2})){3}$"
    },
    "MacAddress": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^([A-F0-9]{2}:){5}[A-F0-9]{2}$"
    },
    "MacAddress1": {
      "type": "string",
      "pattern": "^([A-F0-9]{2}:){5}[A-F0-9]{2}$"
    },
    "Name1": {
      "type": "string",
      "description": "Switch name"
    },
    "deviceCloudConnectionStatusV2": {
      "description": "Socket connection state between device and cloud\n  * `connected`: The device socket connected to cloud.\n  * `disconnected`: The device socket disconnected from cloud.\n",
      "type": "string",
      "enum": [
        "connected",
        "disconnected"
      ]
    }
  }
}