{ "$schema":                  "https://json-schema.org/draft/2020-12/schema",
  "$id":                      "https://schemas.mpai.community/MMM4/V2.2/data/Right.json",
  "title":                    "Right V2.2",
  "type":                     "object",
  "additionalProperties":     false,

  "required":                 [ "Header", "RightID", "DeonticVerb", "Level" ],

  "properties":               {

    "Header":                 { "type": "string", "pattern": "^MMM-RGT-V[0-9]{1,2}[.][0-9]{1,2}$" },
    "MInstanceID":            { "type": "string" },
    "MEnvironmentID":         { "type": "string" },
    "RightID":                { "type": "string" },
    "RightTime":              { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SpaceTime.json" },

    "DeonticVerb":            { "type": "string", "enum": [ "Must", "May", "May Not" ] },

    "PAIDOrPA":               { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "oneOf": [
                              { "type": "object", "additionalProperties": false, "required": [ "ProcessAction" ], "properties": {
      "ProcessAction":        { "$ref": "https://schemas.mpai.community/MMM4/V2.2/data/ProcessAction.json" } } },
                              { "type": "object", "additionalProperties": false,"required": [ "ProcessActionID" ], "properties": {
      "ProcessActionID":      { "type": "string" } } } ] } },

    "Level":                  { "type": "string", "enum": [ "Internal", "Acquired", "Granted" ] },

    "RightStatus":            { "type": "string", "enum": [ "Model", "Final" ], "default": "Model" },

    "Rights":                 { "type": "array", "minItems": 1, "items": { "oneOf": [
                              { "type": "object", "additionalProperties": false, "required": [ "Right" ], "properties": {
      "Right":                { "$ref": "https://schemas.mpai.community/MMM4/V2.2/data/Right.json" } } },
                              { "type": "object", "additionalProperties": false, "required": [ "RightID" ], "properties": {
      "RightID":              { "type": "string" } } } ] } },

    "DataXMData":             { "$ref": "https://schemas.mpai.community/PTF/V1.0/data/DataExchangeMetadata.json" },
    "DescrMetadata":          { "type": "string", "maxLength": 2048 } } }