{
  "$schema": "./crossswitch-rules.schema.json",
  "version": "1.0",
  "description": "CrossSwitch rules for logical camera/monitor mapping",

  "rules": [
    {
      "id": "rule-001",
      "name": "Direct Camera to Monitor",
      "description": "Default rule - map camera directly to monitor on same server",
      "enabled": true,
      "priority": 100,
      "conditions": {
        "cameraRange": [1, 200],
        "monitorRange": [1, 32]
      },
      "action": {
        "type": "viewerConnectLive",
        "routing": "auto"
      }
    },
    {
      "id": "rule-002",
      "name": "Alarm Monitor Override",
      "description": "Prevent switching on monitors with active alarms",
      "enabled": true,
      "priority": 10,
      "conditions": {
        "monitorHasAlarm": true,
        "alarmStates": ["vasNewAlarm", "vasPresented"]
      },
      "action": {
        "type": "deny",
        "reason": "Monitor has active alarm"
      }
    },
    {
      "id": "rule-003",
      "name": "Cross-Server Camera to Monitor",
      "description": "Allow camera from one server to display on monitor of another",
      "enabled": true,
      "priority": 50,
      "conditions": {
        "crossServer": true
      },
      "action": {
        "type": "viewerConnectLive",
        "routing": "monitorServer",
        "note": "Command goes to monitor's server, not camera's server"
      }
    }
  ],

  "defaults": {
    "playMode": "live",
    "switchTimeout": 5000,
    "verifySwitch": true,
    "verifyTimeout": 500
  },

  "alarmMonitorReservation": {
    "enabled": true,
    "description": "When alarm fires, reserve monitor and switch to alarm camera",
    "reservationStates": ["vasNewAlarm", "vasPresented"],
    "autoRelease": false,
    "releaseOnConfirm": true
  }
}
