{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://resolutionprotocol.org/rp/0.2/profile.schema.json",
 "title": "Resolution Protocol profile",
 "description": "One recorder's expression of RP: parameters and localisation. SPEC §8. Readers ignore members they do not understand (§13).",
 "$defs": {
  "level": {
   "type": "integer",
   "minimum": 0,
   "maximum": 5
  },
  "duration": {
   "oneOf": [
    {
     "type": "string",
     "pattern": "^P(?:\\d+Y)?(?:\\d+M)?(?:\\d+W)?(?:\\d+D)?(?:T(?:\\d+H)?(?:\\d+M)?(?:\\d+(?:\\.\\d+)?S)?)?$"
    },
    {
     "type": "number",
     "minimum": 0
    }
   ]
  }
 },
 "type": "object",
 "required": [
  "id",
  "default_level",
  "locales",
  "retention"
 ],
 "properties": {
  "rp": {
   "type": "string",
   "pattern": "^0\\.[0-9]+$"
  },
  "id": {
   "type": "string"
  },
  "name": {
   "type": "string"
  },
  "notes": {
   "type": "string"
  },
  "default_level": {
   "$ref": "#/$defs/level"
  },
  "max_default_level": {
   "$ref": "#/$defs/level",
   "default": 4
  },
  "max_voice_level": {
   "$ref": "#/$defs/level",
   "default": 4
  },
  "invocation": {
   "type": "array",
   "items": {
    "type": "string"
   },
   "default": []
  },
  "locales": {
   "type": "array",
   "minItems": 1,
   "items": {
    "type": "string",
    "description": "BCP 47 tag"
   }
  },
  "objection_window": {
   "$ref": "#/$defs/duration",
   "default": "PT30S",
   "description": "> 0"
  },
  "session_gap": {
   "$ref": "#/$defs/duration",
   "default": "PT10M",
   "description": "> objection_window"
  },
  "attribution_threshold": {
   "type": "number",
   "minimum": 0,
   "maximum": 1,
   "default": 0.8
  },
  "max_participants": {
   "type": "integer",
   "minimum": 1,
   "default": 10
  },
  "room_raise": {
   "enum": [
    "invocation",
    "disabled"
   ],
   "default": "invocation"
  },
  "extensions": {
   "type": "array",
   "items": {
    "anyOf": [
     {
      "enum": [
       "side_conversations",
       "claiming"
      ]
     },
     {
      "type": "string",
      "pattern": "[.:]"
     }
    ]
   },
   "default": [],
   "description": "side_conversations, claiming, or a URI / reverse-domain name"
  },
  "reply_window": {
   "$ref": "#/$defs/duration",
   "default": "PT6S",
   "description": "side_conversations"
  },
  "replies_for_group": {
   "type": "integer",
   "minimum": 1,
   "default": 2,
   "description": "side_conversations"
  },
  "retention": {
   "type": "array",
   "minItems": 1,
   "items": {
    "type": "object",
    "required": [
     "until",
     "max_level"
    ],
    "properties": {
     "until": {
      "$ref": "#/$defs/duration"
     },
     "max_level": {
      "$ref": "#/$defs/level"
     }
    }
   }
  },
  "bindings": {
   "type": "object",
   "description": "Ports (SPEC §10.3): audio_in, speaker_separation, recogniser, intent_parser, store, indicator, handoff, clock, session_source, identity_source. Free-form."
  }
 }
}