{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://lexwire.org/precedent/schema/v1/lexwire-precedent.schema.json",
  "title": "Lex Wire Precedent Authority Artifact Schema (v1)",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "specification",
    "@context",
    "authority_id",
    "issuer",
    "jurisdiction",
    "version",
    "issued",
    "schema",
    "justification_reference",
    "hash",
    "scope"
  ],
  "properties": {
    "specification": {
      "type": "string",
      "const": "LexWirePrecedent/1.0"
    },
    "@context": {
      "type": "string",
      "const": "https://lexwire.org/precedent/context/v1"
    },
    "authority_id": {
      "type": "string",
      "minLength": 8
    },
    "issuer": {
      "type": "string",
      "pattern": "^did:web:[a-zA-Z0-9.-]+$"
    },
    "jurisdiction": {
      "type": "string",
      "minLength": 2,
      "maxLength": 32
    },
    "version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "issued": {
      "type": "string",
      "format": "date-time"
    },
    "schema": {
      "type": "string",
      "format": "uri",
      "const": "https://lexwire.org/precedent/schema/v1/lexwire-precedent.schema.json"
    },
    "justification_reference": {
      "type": "string",
      "format": "uri",
      "const": "https://lexwire.org/precedent"
    },
    "audit_endpoint": {
      "type": "string",
      "format": "uri"
    },
    "hash": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "publisher": {
      "type": "string",
      "minLength": 1
    },
    "description": {
      "type": "string",
      "minLength": 1
    },
    "scope": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "statement",
        "resources",
        "topics"
      ],
      "properties": {
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "resources": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "topics": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    }
  }
}
