274 lines
6.3 KiB
JSON
274 lines
6.3 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://yovision.local/contracts/source-config/v1/source-config.schema.json",
|
|
"title": "YoVision Sense to Brain source configuration snapshot v1",
|
|
"description": "Credential-free media source, profile binding, and normalized rule configuration published by Sense for Brain.",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"schema_version",
|
|
"config_id",
|
|
"revision",
|
|
"published_at",
|
|
"effective_at",
|
|
"site",
|
|
"logical_device",
|
|
"profile",
|
|
"media",
|
|
"rule_set",
|
|
"integrity"
|
|
],
|
|
"properties": {
|
|
"schema_version": {
|
|
"const": "yovision.source-config/v1"
|
|
},
|
|
"config_id": {
|
|
"$ref": "#/$defs/stable_id"
|
|
},
|
|
"revision": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"published_at": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"effective_at": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"site": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["id"],
|
|
"properties": {
|
|
"id": {
|
|
"$ref": "#/$defs/stable_id"
|
|
}
|
|
}
|
|
},
|
|
"logical_device": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["id"],
|
|
"properties": {
|
|
"id": {
|
|
"$ref": "#/$defs/stable_id"
|
|
}
|
|
}
|
|
},
|
|
"profile": {
|
|
"$ref": "#/$defs/profile"
|
|
},
|
|
"media": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["ref", "transport"],
|
|
"properties": {
|
|
"ref": {
|
|
"type": "string",
|
|
"pattern": "^media:[A-Za-z0-9][A-Za-z0-9._~/-]{0,254}$",
|
|
"description": "Opaque credential-free reference resolved by the connector. URI authority, userinfo, query strings, and fragments are forbidden."
|
|
},
|
|
"transport": {
|
|
"enum": ["rtsp"]
|
|
}
|
|
}
|
|
},
|
|
"rule_set": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"version",
|
|
"state",
|
|
"profile_binding",
|
|
"areas",
|
|
"directional_lines"
|
|
],
|
|
"properties": {
|
|
"version": {
|
|
"$ref": "#/$defs/stable_id"
|
|
},
|
|
"state": {
|
|
"enum": ["active", "disabled", "recalibration_required"]
|
|
},
|
|
"profile_binding": {
|
|
"$ref": "#/$defs/profile_binding"
|
|
},
|
|
"areas": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/area_rule"
|
|
},
|
|
"maxItems": 1024
|
|
},
|
|
"directional_lines": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/directional_line_rule"
|
|
},
|
|
"maxItems": 1024
|
|
}
|
|
}
|
|
},
|
|
"integrity": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["algorithm", "value"],
|
|
"properties": {
|
|
"algorithm": {
|
|
"const": "sha256"
|
|
},
|
|
"value": {
|
|
"type": "string",
|
|
"pattern": "^[a-f0-9]{64}$"
|
|
}
|
|
}
|
|
},
|
|
"extensions": {
|
|
"type": "object",
|
|
"description": "Optional namespaced, non-secret extension data. Consumers ignore unknown namespaces.",
|
|
"propertyNames": {
|
|
"pattern": "^[A-Za-z][A-Za-z0-9.-]{0,127}$"
|
|
},
|
|
"additionalProperties": {
|
|
"type": "object"
|
|
}
|
|
}
|
|
},
|
|
"$defs": {
|
|
"stable_id": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 128,
|
|
"pattern": "^[A-Za-z0-9][A-Za-z0-9._~-]*$"
|
|
},
|
|
"positive_integer": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"positive_number": {
|
|
"type": "number",
|
|
"exclusiveMinimum": 0
|
|
},
|
|
"profile": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["id", "width", "height", "encoding", "frame_rate"],
|
|
"properties": {
|
|
"id": {
|
|
"$ref": "#/$defs/stable_id"
|
|
},
|
|
"width": {
|
|
"$ref": "#/$defs/positive_integer"
|
|
},
|
|
"height": {
|
|
"$ref": "#/$defs/positive_integer"
|
|
},
|
|
"encoding": {
|
|
"enum": ["H264", "H265", "MJPEG"]
|
|
},
|
|
"frame_rate": {
|
|
"$ref": "#/$defs/positive_number"
|
|
}
|
|
}
|
|
},
|
|
"profile_binding": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["profile_id", "width", "height"],
|
|
"properties": {
|
|
"profile_id": {
|
|
"$ref": "#/$defs/stable_id"
|
|
},
|
|
"width": {
|
|
"$ref": "#/$defs/positive_integer"
|
|
},
|
|
"height": {
|
|
"$ref": "#/$defs/positive_integer"
|
|
}
|
|
}
|
|
},
|
|
"point": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["x", "y"],
|
|
"properties": {
|
|
"x": {
|
|
"type": "number",
|
|
"minimum": 0,
|
|
"maximum": 1
|
|
},
|
|
"y": {
|
|
"type": "number",
|
|
"minimum": 0,
|
|
"maximum": 1
|
|
}
|
|
}
|
|
},
|
|
"area_rule": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["id", "version", "kind", "enabled", "points"],
|
|
"properties": {
|
|
"id": {
|
|
"$ref": "#/$defs/stable_id"
|
|
},
|
|
"version": {
|
|
"$ref": "#/$defs/positive_integer"
|
|
},
|
|
"kind": {
|
|
"const": "danger_area"
|
|
},
|
|
"enabled": {
|
|
"type": "boolean"
|
|
},
|
|
"points": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/point"
|
|
},
|
|
"minItems": 3,
|
|
"maxItems": 256
|
|
}
|
|
}
|
|
},
|
|
"directional_line_rule": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"id",
|
|
"version",
|
|
"kind",
|
|
"enabled",
|
|
"start",
|
|
"end",
|
|
"trigger_direction"
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"$ref": "#/$defs/stable_id"
|
|
},
|
|
"version": {
|
|
"$ref": "#/$defs/positive_integer"
|
|
},
|
|
"kind": {
|
|
"const": "directional_line"
|
|
},
|
|
"enabled": {
|
|
"type": "boolean"
|
|
},
|
|
"start": {
|
|
"$ref": "#/$defs/point"
|
|
},
|
|
"end": {
|
|
"$ref": "#/$defs/point"
|
|
},
|
|
"trigger_direction": {
|
|
"enum": ["left_to_right", "right_to_left"]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|