{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/welkaim/ea-codex/schemas/v1/enterprise-intent.json",
  "title": "EnterpriseIntent",
  "description": "Structured statement of business outcome and constraints. The EnterpriseIntent is the entry point of the ea.codex/v1 family. Every other artifact ultimately resolves to one or more intents.",
  "type": "object",
  "required": ["apiVersion", "kind", "metadata", "spec"],
  "properties": {
    "apiVersion": { "$ref": "_common.json#/$defs/apiVersion" },
    "kind": { "type": "string", "const": "EnterpriseIntent" },
    "metadata": { "$ref": "_common.json#/$defs/metadata" },
    "spec": {
      "type": "object",
      "required": ["outcome"],
      "properties": {
        "outcome": {
          "type": "string",
          "description": "The business outcome this intent expresses. One or two sentences.",
          "minLength": 10
        },
        "value": {
          "type": "string",
          "description": "The value the enterprise expects to gain when the outcome is realized."
        },
        "successMeasures": {
          "type": "array",
          "description": "Concrete measurable indicators of success.",
          "items": {
            "type": "object",
            "required": ["name", "target"],
            "properties": {
              "name": { "type": "string" },
              "target": { "type": "string" },
              "measurementMethod": { "type": "string" }
            },
            "additionalProperties": false
          }
        },
        "constraints": {
          "type": "array",
          "description": "Non-negotiable constraints under which the intent must be realized.",
          "items": { "type": "string" }
        },
        "affectedCapabilities": {
          "type": "array",
          "description": "Business capabilities impacted by this intent.",
          "items": { "type": "string" },
          "minItems": 1
        },
        "decisionObligations": {
          "type": "array",
          "description": "Decisions that must be made before execution can begin.",
          "items": { "type": "string" }
        },
        "stakeholders": {
          "type": "array",
          "items": { "type": "string" }
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": false
}
