{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://intelligentism.isilp.org/schemas/economic-model.schema.json",
  "title": "Economic Model",
  "description": "Registry record for a published Intelligentism formula or simulation. Every model must publish its assumptions and limitations; a model without them is not publishable.",
  "type": "object",
  "required": ["id", "name", "latex", "purpose", "variables", "assumptions", "limitations", "version", "status"],
  "additionalProperties": false,
  "properties": {
    "id": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$" },
    "name": { "type": "string" },
    "latex": { "type": "string" },
    "plain": { "type": "string", "description": "Plain-English restatement of the formula." },
    "purpose": { "type": "string" },
    "variables": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["symbol", "meaning", "unit"],
        "additionalProperties": false,
        "properties": {
          "symbol": { "type": "string" },
          "meaning": { "type": "string" },
          "unit": { "type": "string" }
        }
      }
    },
    "assumptions": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
    "limitations": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
    "example": { "type": "string" },
    "sensitivity": { "type": "string", "description": "Which input dominates the result and by how much." },
    "testCases": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["inputs", "expected"],
        "additionalProperties": false,
        "properties": {
          "label": { "type": "string" },
          "inputs": { "type": "object" },
          "expected": { "type": "number" },
          "tolerance": { "type": "number", "default": 0.001 }
        }
      }
    },
    "specificationPath": { "type": "string" },
    "proposalIds": { "type": "array", "items": { "type": "string", "pattern": "^IIP-[0-9]{4}$" } },
    "version": { "type": "string" },
    "status": {
      "type": "string",
      "enum": ["concept", "draft", "research", "review", "pilot", "accepted", "deprecated", "superseded"]
    }
  }
}
