{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/commsharbor/json-schema/commsharbor-template-schema.json",
  "title": "Template",
  "description": "An email template as a draft. Published versions are immutable and live in their own resource.",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/commsharbor-organizations-api-openapi.yml#/components/schemas/Template",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Template ID."
    },
    "name": {
      "type": "string",
      "description": "Template name."
    },
    "message_type": {
      "type": "string",
      "description": "What it may be used for."
    },
    "subject": {
      "type": "string",
      "description": "Subject line, with `{{variable}}` placeholders."
    },
    "variables": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Typed variables the template declares: name, type and whether it is required."
    },
    "blocks": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Canonical content blocks. Imported HTML is converted into these."
    },
    "status": {
      "type": "string",
      "description": "Draft state."
    },
    "latest_version": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Highest published version; null while never published."
    },
    "updated_at": {
      "type": [
        "string",
        "null"
      ],
      "description": "Last change (UTC)."
    }
  },
  "required": [
    "id",
    "name",
    "message_type",
    "subject",
    "variables",
    "blocks",
    "status",
    "latest_version",
    "updated_at"
  ]
}