{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developer.reits.tech/schemas/auth-s08-owner-authority-set.v1.schema.json",
  "title": "Auth S08 R02 四席外部权威集合",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "dossierDigest",
    "authorities"
  ],
  "properties": {
    "schemaVersion": {
      "const": "reits.tech/auth-s08-owner-authority-set/v1"
    },
    "dossierDigest": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "authorities": {
      "type": "array",
      "minItems": 4,
      "maxItems": 4,
      "prefixItems": [
        {
          "$ref": "#/$defs/auth"
        },
        {
          "$ref": "#/$defs/security"
        },
        {
          "$ref": "#/$defs/sreDba"
        },
        {
          "$ref": "#/$defs/qaWitness"
        }
      ],
      "items": false
    }
  },
  "$defs": {
    "authorityBase": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "ownerId",
        "identityRef",
        "keyRef",
        "publicKey",
        "delegationAllowed"
      ],
      "properties": {
        "ownerId": {
          "type": "string"
        },
        "identityRef": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9+.-]*://",
          "minLength": 8,
          "maxLength": 512
        },
        "keyRef": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9+.-]*://",
          "minLength": 8,
          "maxLength": 512
        },
        "publicKey": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{43}$"
        },
        "delegationAllowed": {
          "const": false
        }
      }
    },
    "auth": {
      "allOf": [
        {
          "$ref": "#/$defs/authorityBase"
        },
        {
          "properties": {
            "ownerId": {
              "const": "AUTH"
            }
          }
        }
      ]
    },
    "security": {
      "allOf": [
        {
          "$ref": "#/$defs/authorityBase"
        },
        {
          "properties": {
            "ownerId": {
              "const": "SECURITY"
            }
          }
        }
      ]
    },
    "sreDba": {
      "allOf": [
        {
          "$ref": "#/$defs/authorityBase"
        },
        {
          "properties": {
            "ownerId": {
              "const": "SRE_DBA"
            }
          }
        }
      ]
    },
    "qaWitness": {
      "allOf": [
        {
          "$ref": "#/$defs/authorityBase"
        },
        {
          "properties": {
            "ownerId": {
              "const": "QA_WITNESS"
            }
          }
        }
      ]
    }
  }
}
