{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://embedda.dev/schemas/node-capabilities.v1.schema.json",
  "title": "Embedda node capabilities declaration (v1)",
  "description": "FROZEN v1 - the honest capability declaration a node serves at GET /api/v1/capabilities and the one a third-party node ships in its package descriptor. Projection of components/schemas/NodeCapabilities in contracts/openapi/node-api.yaml (single source; extracted mechanically). Example instance: contracts/examples/node-capabilities.json.",
  "type": "object",
  "required": [
    "summary",
    "cameras",
    "streams",
    "world",
    "actions",
    "security"
  ],
  "properties": {
    "summary": {
      "$ref": "#/$defs/NodeSummary"
    },
    "cameras": {
      "$ref": "#/$defs/NodeCameraCapabilities"
    },
    "streams": {
      "$ref": "#/$defs/NodeStreamCapabilities"
    },
    "world": {
      "$ref": "#/$defs/NodeWorldCapabilities"
    },
    "actions": {
      "$ref": "#/$defs/NodeActionCapabilities"
    },
    "security": {
      "$ref": "#/$defs/NodeSecurityCapabilities"
    }
  },
  "$defs": {
    "NodeActionCapabilities": {
      "type": "object",
      "required": [
        "activate_camera",
        "set_mode",
        "set_producer",
        "auto_ptz",
        "ptz_presets",
        "perception_settings",
        "brain_profiles",
        "commands_api"
      ],
      "properties": {
        "activate_camera": {
          "type": "boolean"
        },
        "set_mode": {
          "type": "boolean"
        },
        "set_producer": {
          "type": "boolean"
        },
        "auto_ptz": {
          "type": "boolean"
        },
        "ptz_presets": {
          "type": "boolean"
        },
        "perception_settings": {
          "type": "boolean"
        },
        "brain_profiles": {
          "type": "boolean"
        },
        "commands_api": {
          "type": "boolean"
        }
      }
    },
    "NodeCameraCapabilities": {
      "type": "object",
      "required": [
        "count",
        "active_camera_id",
        "mode",
        "rtsp_supported",
        "configured_rtsp_count",
        "onvif_supported",
        "configured_onvif_count",
        "dvr_nvr_supported",
        "auto_ptz_supported",
        "auto_ptz_enabled_count",
        "ptz_config_supported"
      ],
      "properties": {
        "count": {
          "type": "integer",
          "minimum": 0
        },
        "active_camera_id": {
          "type": "string"
        },
        "mode": {
          "type": "string",
          "enum": [
            "fixed",
            "patrol"
          ]
        },
        "rtsp_supported": {
          "type": "boolean"
        },
        "configured_rtsp_count": {
          "type": "integer",
          "minimum": 0
        },
        "onvif_supported": {
          "type": "boolean"
        },
        "configured_onvif_count": {
          "type": "integer",
          "minimum": 0
        },
        "dvr_nvr_supported": {
          "type": "boolean",
          "description": "DVR/NVR channels are supported when exposed as RTSP streams."
        },
        "auto_ptz_supported": {
          "type": "boolean"
        },
        "auto_ptz_enabled_count": {
          "type": "integer",
          "minimum": 0
        },
        "ptz_config_supported": {
          "type": "boolean"
        }
      }
    },
    "NodeSecurityCapabilities": {
      "type": "object",
      "required": [
        "profile",
        "transport",
        "key_establishment",
        "node_identity",
        "artifact_signatures",
        "api_bearer_required",
        "admin_bearer_required",
        "descriptor_signing_supported",
        "descriptor_expires_at"
      ],
      "properties": {
        "profile": {
          "type": "string",
          "enum": [
            "classical",
            "hybrid-pqc",
            "pqc-required",
            "unknown"
          ]
        },
        "profile_self_reported": {
          "type": "boolean",
          "default": false,
          "description": "True when the security-profile fields above carry values DECLARED by node config rather than measured \u2014 consoles must badge them as \"declared, unverified\" (honesty rule). The bearer fields reflect real enforced token config and are never self-reported.\n"
        },
        "transport": {
          "type": "string",
          "description": "Reported transport profile. `not_reported` means node-api cannot observe negotiated TLS."
        },
        "key_establishment": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Advertised or configured KEM/key-establishment algorithms."
        },
        "node_identity": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Advertised or configured node identity signature algorithms."
        },
        "artifact_signatures": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Advertised or configured artifact signature algorithms."
        },
        "api_bearer_required": {
          "type": "boolean"
        },
        "admin_bearer_required": {
          "type": "boolean"
        },
        "descriptor_signing_supported": {
          "type": "boolean"
        },
        "descriptor_expires_at": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "NodeStreamCapabilities": {
      "type": "object",
      "required": [
        "events_ws_path",
        "video_ws_path",
        "go2rtc_path",
        "h264_video_supported"
      ],
      "properties": {
        "events_ws_path": {
          "type": "string"
        },
        "video_ws_path": {
          "type": "string"
        },
        "go2rtc_path": {
          "type": "string"
        },
        "h264_video_supported": {
          "type": "boolean"
        }
      }
    },
    "NodeSummary": {
      "type": "object",
      "required": [
        "node_id",
        "display_name",
        "role",
        "backend",
        "accelerator",
        "mode",
        "version"
      ],
      "properties": {
        "node_id": {
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "role": {
          "type": "string",
          "enum": [
            "inference",
            "monitor"
          ]
        },
        "backend": {
          "type": "string",
          "enum": [
            "hailo",
            "gpu",
            "cpu",
            "unknown"
          ]
        },
        "accelerator": {
          "type": "string"
        },
        "mode": {
          "type": "string",
          "enum": [
            "fixed",
            "patrol"
          ]
        },
        "version": {
          "type": "string"
        }
      }
    },
    "NodeWorldCapabilities": {
      "type": "object",
      "required": [
        "endpoint",
        "available",
        "site_frame_configured",
        "snapshot_sync_supported",
        "pheromone_sync_supported"
      ],
      "properties": {
        "endpoint": {
          "type": "string"
        },
        "available": {
          "type": "boolean"
        },
        "space_endpoint": {
          "type": "string",
          "default": ""
        },
        "space_graph_endpoint": {
          "type": "string",
          "default": ""
        },
        "space_frames_endpoint": {
          "type": "string",
          "default": ""
        },
        "space_fields_endpoint": {
          "type": "string",
          "default": ""
        },
        "space_fabric_endpoint": {
          "type": "string",
          "default": ""
        },
        "space_config_supported": {
          "type": "boolean",
          "default": false
        },
        "space_etag_supported": {
          "type": "boolean",
          "default": false
        },
        "site_frame_configured": {
          "type": "boolean"
        },
        "snapshot_sync_supported": {
          "type": "boolean"
        },
        "pheromone_sync_supported": {
          "type": "boolean"
        }
      }
    }
  }
}
