{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://intelligentism.isilp.org/schemas/institution.schema.json",
  "title": "Voluntary Institution",
  "description": "Charter record for an Intelligentism voluntary institution. An organisation missing any required field is not a conforming institution.",
  "type": "object",
  "required": ["id", "name", "mission", "authority", "participation", "publication", "audit", "sunset"],
  "additionalProperties": false,
  "properties": {
    "id": { "type": "string" },
    "name": { "type": "string" },
    "domain": {
      "type": "string",
      "description": "Mission domain, e.g. energy, water, housing, medicine, artificial intelligence."
    },
    "mission": { "type": "string" },
    "charterUrl": { "type": "string", "format": "uri" },
    "authority": {
      "type": "array",
      "description": "Enumerated powers. Authority not enumerated is not held.",
      "items": { "type": "string" },
      "minItems": 1
    },
    "resources": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "capital",
          "research",
          "facilities",
          "equipment",
          "data",
          "engineering",
          "legal",
          "regulatory",
          "procurement",
          "distribution"
        ]
      }
    },
    "participation": {
      "type": "object",
      "required": ["optIn", "termsUrl", "exitTerms"],
      "additionalProperties": false,
      "properties": {
        "optIn": { "type": "boolean", "const": true },
        "termsUrl": { "type": "string", "format": "uri" },
        "exitTerms": { "type": "string" },
        "participantProfitShare": { "type": "number", "minimum": 0, "maximum": 1 },
        "institutionReturnShare": { "type": "number", "minimum": 0, "maximum": 1 }
      }
    },
    "publication": {
      "type": "object",
      "required": ["outcomes", "failures", "conflictsOfInterest"],
      "additionalProperties": false,
      "properties": {
        "outcomes": { "type": "boolean", "const": true },
        "failures": { "type": "boolean", "const": true },
        "conflictsOfInterest": { "type": "boolean", "const": true },
        "cadence": { "type": "string" }
      }
    },
    "audit": {
      "type": "object",
      "required": ["independent", "auditor"],
      "additionalProperties": false,
      "properties": {
        "independent": { "type": "boolean", "const": true },
        "auditor": { "type": "string" },
        "lastAudit": { "type": "string", "format": "date" },
        "findingsUrl": { "type": "string", "format": "uri" }
      }
    },
    "leadership": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "removable": { "type": "boolean", "const": true },
        "removalProcedure": { "type": "string" },
        "termYears": { "type": "integer", "minimum": 1 }
      }
    },
    "sunset": {
      "type": "object",
      "required": ["expires"],
      "additionalProperties": false,
      "properties": {
        "expires": { "type": "string", "format": "date" },
        "renewalCriteria": { "type": "string" }
      }
    },
    "status": {
      "type": "string",
      "enum": ["concept", "draft", "research", "review", "pilot", "accepted", "deprecated", "superseded"]
    }
  }
}
