{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://prism-framework.org/schema/1.0/intent",
  "title": "PRISM — I: Intent",
  "description": "Captures why the enterprise exists in its current form and when its decisions matter. Covers business drivers, goals, timelines, and constraints.",
  "type": "object",
  "required": ["prism"],
  "additionalProperties": false,
  "properties": {
    "prism": {
      "type": "object",
      "required": ["layer", "schema_version"],
      "additionalProperties": false,
      "properties": {
        "layer": { "const": "intent" },
        "schema_version": { "type": "string", "pattern": "^\\d+\\.\\d+$" },
        "temporal_state": { "type": "string", "enum": ["baseline", "transition", "target"] },
        "as_of": { "type": "string", "format": "date" },
        "label": { "type": "string" }
      }
    },
    "drivers": {
      "type": "array",
      "description": "Business motivations behind architectural choices — market forces, regulatory requirements, cost pressures, strategic bets.",
      "items": {
        "type": "object",
        "required": ["id", "name", "category"],
        "additionalProperties": false,
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "category": {
            "type": "string",
            "enum": ["regulatory", "market", "cost", "technology", "risk", "strategic", "operational", "environmental"],
            "description": "The nature of this driver."
          },
          "description": { "type": "string" },
          "urgency": {
            "type": "string",
            "enum": ["immediate", "short-term", "medium-term", "long-term"],
            "description": "Time horizon for this driver."
          },
          "owner_stakeholder_id": { "type": "string" },
          "notes": { "type": "string" }
        }
      }
    },
    "goals": {
      "type": "array",
      "description": "Desired outcomes tied to drivers. Express as measurable targets where possible.",
      "items": {
        "type": "object",
        "required": ["id", "name", "driver_ids"],
        "additionalProperties": false,
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "description": { "type": "string" },
          "driver_ids": {
            "type": "array",
            "items": { "type": "string" },
            "minItems": 1,
            "description": "The drivers this goal responds to."
          },
          "success_metric": {
            "type": "string",
            "description": "How success will be measured (e.g., 'Claims processed in <2 days', 'Zero critical regulatory findings')."
          },
          "target_date": {
            "type": "string",
            "format": "date"
          },
          "owner_stakeholder_id": { "type": "string" },
          "notes": { "type": "string" }
        }
      }
    },
    "timelines": {
      "type": "array",
      "description": "When things matter — compliance deadlines, market windows, fiscal cycles, event-driven triggers.",
      "items": {
        "type": "object",
        "required": ["id", "name", "date"],
        "additionalProperties": false,
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "date": {
            "type": "string",
            "format": "date",
            "description": "The date or deadline this timeline event refers to."
          },
          "type": {
            "type": "string",
            "enum": ["deadline", "milestone", "review-gate", "market-event", "fiscal-year-end", "trigger"]
          },
          "description": { "type": "string" },
          "goal_ids": {
            "type": "array",
            "items": { "type": "string" }
          },
          "notes": { "type": "string" }
        }
      }
    },
    "constraints": {
      "type": "array",
      "description": "Non-negotiable boundaries — budget caps, legal mandates, technical debt ceilings, policy limits.",
      "items": {
        "type": "object",
        "required": ["id", "name", "type"],
        "additionalProperties": false,
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "type": {
            "type": "string",
            "enum": ["budget", "legal", "policy", "technical", "time", "resource", "regulatory"]
          },
          "description": { "type": "string" },
          "enforced_by": {
            "type": "string",
            "description": "The authority or mechanism enforcing this constraint (stakeholder ID, regulation name, etc.)."
          },
          "notes": { "type": "string" }
        }
      }
    },
    "risks": {
      "type": "array",
      "description": "Identified risks that could prevent goals from being achieved or harm the enterprise. Expressed as If-Then: If [condition occurs], Then [impact].",
      "items": {
        "type": "object",
        "required": ["id", "name", "category", "likelihood", "impact"],
        "additionalProperties": false,
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "category": {
            "type": "string",
            "enum": ["strategic", "operational", "security", "regulatory", "technology", "financial", "program", "reputational"],
            "description": "Risk category."
          },
          "if_condition": {
            "type": "string",
            "description": "The condition or event that triggers this risk (the 'If' in If-Then). Be specific — vague conditions are unactionable."
          },
          "then_impact": {
            "type": "string",
            "description": "The consequence if the risk materializes (the 'Then' in If-Then). State impact on goals, operations, or stakeholders."
          },
          "likelihood": {
            "type": "string",
            "enum": ["rare", "unlikely", "possible", "likely", "almost-certain"],
            "description": "Estimated probability of the risk occurring."
          },
          "impact": {
            "type": "string",
            "enum": ["negligible", "minor", "moderate", "major", "critical"],
            "description": "Severity of impact if the risk materializes."
          },
          "response": {
            "type": "string",
            "enum": ["mitigate", "accept", "transfer", "avoid"],
            "description": "The chosen risk response strategy."
          },
          "mitigation": {
            "type": "string",
            "description": "Specific actions taken or planned to reduce likelihood or impact. Required when response is 'mitigate'."
          },
          "affected_goal_ids": {
            "type": "array",
            "items": { "type": "string" },
            "description": "Goals this risk threatens."
          },
          "owner_stakeholder_id": { "type": "string" },
          "status": {
            "type": "string",
            "enum": ["identified", "under-review", "mitigated", "accepted", "transferred", "realized"],
            "description": "'realized' means the risk event has occurred."
          },
          "notes": { "type": "string" }
        }
      }
    }
  }
}
