{
  "$defs": {
    "ApprovalProvenance": {
      "additionalProperties": false,
      "properties": {
        "approved_by": {
          "maxLength": 300,
          "minLength": 1,
          "title": "Approved By",
          "type": "string"
        },
        "approved_at": {
          "format": "date-time",
          "title": "Approved At",
          "type": "string"
        },
        "revision_digest": {
          "pattern": "^sha256:[a-f0-9]{64}(?![\\s\\S])",
          "title": "Revision Digest",
          "type": "string"
        }
      },
      "required": [
        "approved_by",
        "approved_at",
        "revision_digest"
      ],
      "title": "ApprovalProvenance",
      "type": "object"
    },
    "IntentRequirement": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "maxLength": 300,
          "minLength": 1,
          "title": "Id",
          "type": "string"
        },
        "desired_outcome": {
          "maxLength": 2000,
          "minLength": 1,
          "title": "Desired Outcome",
          "type": "string"
        },
        "forbidden_outcomes": {
          "items": {
            "maxLength": 2000,
            "minLength": 1,
            "type": "string"
          },
          "title": "Forbidden Outcomes",
          "type": "array"
        }
      },
      "required": [
        "id",
        "desired_outcome",
        "forbidden_outcomes"
      ],
      "title": "IntentRequirement",
      "type": "object"
    }
  },
  "additionalProperties": false,
  "properties": {
    "extensions": {
      "additionalProperties": false,
      "patternProperties": {
        "^[a-z0-9]+(?:[.-][a-z0-9]+)+:[A-Za-z0-9_.-]+(?![\\s\\S])": {}
      },
      "title": "Extensions",
      "type": "object"
    },
    "record_type": {
      "const": "intent-record.v1",
      "default": "intent-record.v1",
      "title": "Record Type",
      "type": "string"
    },
    "id": {
      "maxLength": 300,
      "minLength": 1,
      "title": "Id",
      "type": "string"
    },
    "revision": {
      "exclusiveMinimum": 0,
      "title": "Revision",
      "type": "integer"
    },
    "proposed_by": {
      "maxLength": 300,
      "minLength": 1,
      "title": "Proposed By",
      "type": "string"
    },
    "scope": {
      "default": "pr_completion",
      "enum": [
        "pr_completion",
        "full_lifecycle"
      ],
      "title": "Scope",
      "type": "string"
    },
    "source_references": {
      "items": {
        "maxLength": 300,
        "minLength": 1,
        "type": "string"
      },
      "title": "Source References",
      "type": "array"
    },
    "requirements": {
      "items": {
        "$ref": "#/$defs/IntentRequirement"
      },
      "title": "Requirements",
      "type": "array"
    },
    "approval": {
      "anyOf": [
        {
          "$ref": "#/$defs/ApprovalProvenance"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "id",
    "revision",
    "proposed_by",
    "source_references",
    "requirements"
  ],
  "title": "IntentRecord",
  "type": "object"
}
