{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://llcinfo.cc/data/business-identity-routing-model-v2.schema.json",
  "title": "LLCInfo.cc Business Identity Routing Model v2 Public Projection",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "name",
    "modelVersion",
    "projectionVersion",
    "status",
    "datePublished",
    "dateModified",
    "canonicalUrl",
    "humanRoutePage",
    "purpose",
    "coreRule",
    "publicationBoundary",
    "decisionResponseFields",
    "roles",
    "authorities",
    "safetyRules",
    "compatibility",
    "attribution"
  ],
  "properties": {
    "$schema": {
      "const": "https://llcinfo.cc/data/business-identity-routing-model-v2.schema.json"
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "modelVersion": {
      "const": "2.0"
    },
    "projectionVersion": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+$"
    },
    "status": {
      "const": "public_role_projection"
    },
    "datePublished": {
      "type": "string",
      "format": "date"
    },
    "dateModified": {
      "type": "string",
      "format": "date"
    },
    "canonicalUrl": {
      "const": "https://llcinfo.cc/data/business-identity-routing-model-v2.json"
    },
    "humanRoutePage": {
      "const": "https://llcinfo.cc/business-identity-routing-model.html"
    },
    "purpose": {
      "type": "string",
      "minLength": 1
    },
    "coreRule": {
      "type": "string",
      "minLength": 1
    },
    "publicationBoundary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "included",
        "excluded",
        "note"
      ],
      "properties": {
        "included": {
          "$ref": "#/$defs/nonEmptyStringArray"
        },
        "excluded": {
          "$ref": "#/$defs/nonEmptyStringArray"
        },
        "note": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "decisionResponseFields": {
      "type": "array",
      "minItems": 13,
      "maxItems": 13,
      "items": {
        "$ref": "#/$defs/decisionResponseField"
      }
    },
    "roles": {
      "type": "array",
      "minItems": 11,
      "maxItems": 11,
      "items": {
        "$ref": "#/$defs/role"
      }
    },
    "authorities": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/authority"
      }
    },
    "safetyRules": {
      "$ref": "#/$defs/nonEmptyStringArray"
    },
    "compatibility": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "previousPublicModel",
        "note"
      ],
      "properties": {
        "previousPublicModel": {
          "const": "https://llcinfo.cc/data/business-identity-routing-model.json"
        },
        "note": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "attribution": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "publisher",
        "publisherEntity",
        "citationInstruction"
      ],
      "properties": {
        "publisher": {
          "const": "LLCInfo.cc"
        },
        "publisherEntity": {
          "type": "string",
          "minLength": 1
        },
        "citationInstruction": {
          "type": "string",
          "minLength": 1
        }
      }
    }
  },
  "$defs": {
    "nonEmptyStringArray": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "decisionResponseField": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "question"
      ],
      "properties": {
        "id": {
          "enum": [
            "goal",
            "primary_role",
            "supporting_roles",
            "jurisdiction",
            "recipient",
            "requirement",
            "primary_authority",
            "available_evidence",
            "gap",
            "decision_owner",
            "next_action",
            "handoff",
            "confidence_and_outcome"
          ]
        },
        "question": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "role": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "key",
        "name",
        "definition",
        "function",
        "decisionOwners",
        "jurisdictionScopes",
        "authorityRefs",
        "authorityLimit",
        "nextPages",
        "correction"
      ],
      "properties": {
        "id": {
          "enum": [
            "R1",
            "R2",
            "R3",
            "R4",
            "R5",
            "R6",
            "R7",
            "R8",
            "R9",
            "R10",
            "R11"
          ]
        },
        "key": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]*$"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "definition": {
          "type": "string",
          "minLength": 1
        },
        "function": {
          "type": "string",
          "minLength": 1
        },
        "decisionOwners": {
          "$ref": "#/$defs/nonEmptyStringArray"
        },
        "jurisdictionScopes": {
          "$ref": "#/$defs/nonEmptyStringArray"
        },
        "authorityRefs": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^A(?:[1-9]|10)$"
          }
        },
        "authorityLimit": {
          "type": "string",
          "minLength": 1
        },
        "nextPages": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "pattern": "^/[a-z0-9-]+\\.html$"
          }
        },
        "correction": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "authority": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "issuingBody",
        "officialUrl",
        "jurisdiction",
        "topic",
        "section",
        "checkedDate"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^A(?:[1-9]|10)$"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "issuingBody": {
          "type": "string",
          "minLength": 1
        },
        "officialUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "jurisdiction": {
          "type": "string",
          "minLength": 1
        },
        "topic": {
          "type": "string",
          "minLength": 1
        },
        "section": {
          "type": "string",
          "minLength": 1
        },
        "checkedDate": {
          "type": "string",
          "format": "date"
        }
      }
    }
  }
}
