{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://heartcortex.ai/schemas/1.0/subscription.schema.json",
  "title": "Subscription",
  "type": "object",
  "required": [
    "sink",
    "types"
  ],
  "properties": {
    "id": {
      "$ref": "common.schema.json#/$defs/uuid",
      "readOnly": true
    },
    "sink": {
      "description": "https webhook URL.",
      "type": "string",
      "format": "uri",
      "pattern": "^https://"
    },
    "types": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "$ref": "common.schema.json#/$defs/messageType"
      }
    },
    "minSeverity": {
      "$ref": "common.schema.json#/$defs/severity"
    },
    "status": {
      "enum": [
        "pending-validation",
        "active",
        "suspended"
      ],
      "readOnly": true
    },
    "createdAt": {
      "$ref": "common.schema.json#/$defs/timestamp",
      "readOnly": true
    },
    "expiresAt": {
      "$ref": "common.schema.json#/$defs/timestamp"
    },
    "paused": {
      "type": "boolean",
      "default": false,
      "description": "While true, nothing is delivered and nothing is kept for later (D30). Set with PATCH /heart/v1/subscriptions/{id}."
    }
  }
}
