{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://sdk.vorivox.com/schemas/vorivox.launch.v1.schema.json",
  "title": "VORIVOX Launch Manifest v1",
  "type": "object",
  "additionalProperties": true,
  "required": ["schema", "session_id", "session_token", "game_id", "game_version", "bridge", "display", "target_profile", "paths", "game", "session"],
  "properties": {
    "schema": {"const": "vorivox.launch.v1"},
    "session_id": {"type": "string", "minLength": 1},
    "session_token": {"type": "string", "minLength": 1},
    "game_id": {"type": "string", "minLength": 1},
    "game_version": {"type": "string", "minLength": 1},
    "sdk_version": {"type": "string", "default": "1.0"},
    "run_mode": {"type": "string", "default": "licensed"},
    "locale": {"type": "string", "default": "ru-RU"},
    "bridge": {
      "type": "object",
      "additionalProperties": true,
      "required": ["transport", "url", "heartbeat_interval_ms"],
      "properties": {
        "transport": {"const": "websocket"},
        "url": {"type": "string", "pattern": "^ws://(127\\.0\\.0\\.1|localhost)(:[0-9]+)?/"},
        "heartbeat_interval_ms": {"type": "integer", "minimum": 200}
      }
    },
    "display": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "operator_display_index": {"type": "integer", "minimum": 0},
        "projector_display_index": {"type": "integer", "minimum": 0},
        "projector_fullscreen": {"type": "boolean"}
      }
    },
    "target_profile": {
      "type": "object",
      "additionalProperties": true,
      "required": ["width_mm", "height_mm"],
      "properties": {
        "width_mm": {"type": "integer", "minimum": 1},
        "height_mm": {"type": "integer", "minimum": 1},
        "coord_origin": {"const": "bottom_left", "default": "bottom_left"},
        "profile_id": {"type": "string"}
      }
    },
    "paths": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "persistent_dir": {"type": "string"},
        "cache_dir": {"type": "string"},
        "log_dir": {"type": "string"}
      }
    },
    "game": {
      "type": "object",
      "additionalProperties": true,
      "required": ["players"],
      "properties": {"players": {"$ref": "#/$defs/players"}}
    },
    "session": {
      "type": "object",
      "additionalProperties": true,
      "required": ["player_count"],
      "properties": {
        "player_count": {"enum": [1, 2]},
        "mode": {"type": "string", "minLength": 1},
        "countdown_ms": {"type": "integer", "minimum": 0}
      }
    }
  },
  "$defs": {
    "players": {
      "type": "object",
      "additionalProperties": true,
      "required": ["supported_counts", "default_count"],
      "properties": {
        "supported_counts": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"enum": [1, 2]}},
        "default_count": {"enum": [1, 2]},
        "session_modes": {"type": "array", "items": {"type": "string", "minLength": 1}},
        "same_screen": {"type": "boolean"}
      }
    }
  }
}
