{
  "title": "Subscription Spec",
  "description": "SubscriptionSpec subscribes to another resource's events (Core §4.6, Ref D35,\n02-core-extended.md §3).\n\nTier 1 (Core, outbox): Events + Handler only.\nTier 2 (Streaming): adds store, retention, position, max_retry, dead_letter,\nfilter, transform, and explicit delivery channel.\n",
  "type": "object",
  "properties": {
    "dead_letter": {
      "$ref": "#/$defs/DeliveryTarget",
      "description": "Tier 2",
      "nullable": true
    },
    "delivery": {
      "$ref": "#/$defs/SubDeliveryDecl",
      "description": "Tier 2: delivery channel",
      "nullable": true
    },
    "durability": {
      "description": "Tier 2: durability mode (\"durable\" = streaming)",
      "type": "string"
    },
    "events": {
      "description": "@schema {example: \"billing.invoice.on_submit\"}",
      "type": "array",
      "items": {
        "type": "string"
      },
      "examples": [
        "billing.invoice.on_submit"
      ]
    },
    "filter": {
      "description": "Tier 2: Starlark filter over event payload",
      "type": "string"
    },
    "handler": {
      "$ref": "#/$defs/ImplDecl"
    },
    "max_retry": {
      "description": "Tier 2",
      "type": "integer"
    },
    "position": {
      "description": "@schema {example: \"latest\", enum: [\"latest\", \"earliest\"]}",
      "type": "string",
      "enum": [
        "latest",
        "earliest"
      ],
      "examples": [
        "latest"
      ]
    },
    "retention": {
      "description": "Tier 2: stream retention duration",
      "type": "string"
    },
    "retry": {
      "$ref": "#/$defs/RetryDecl",
      "description": "Tier 2",
      "nullable": true
    },
    "store": {
      "description": "@schema {example: \"redis\"}",
      "type": "string",
      "examples": [
        "redis"
      ]
    },
    "transform": {
      "description": "Tier 2: Starlark transform over event payload",
      "type": "string"
    },
    "uses": {
      "$ref": "#/$defs/UsesDecl",
      "description": "Uses declares what the HANDLER may touch — the same shape and the same",
      "nullable": true
    }
  },
  "required": [
    "handler"
  ],
  "additionalProperties": false
}