{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/viridi-parente/main/json-schema/viridi-parente-notification-template-schema.json",
  "title": "NotificationTemplate",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/viridi-parente-notification-template-controller-api-openapi.yml#/components/schemas/NotificationTemplate",
  "properties": {
    "id": {
      "$ref": "#/$defs/NotificationTemplateId"
    },
    "createdTime": {
      "type": "integer",
      "format": "int64"
    },
    "tenantId": {
      "$ref": "#/$defs/TenantId"
    },
    "name": {
      "type": "string"
    },
    "notificationType": {
      "type": "string",
      "enum": [
        "GENERAL",
        "ALARM",
        "DEVICE_ACTIVITY",
        "ENTITY_ACTION",
        "ALARM_COMMENT",
        "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT",
        "ALARM_ASSIGNMENT",
        "NEW_PLATFORM_VERSION",
        "ENTITIES_LIMIT",
        "API_USAGE_LIMIT",
        "RULE_NODE",
        "RATE_LIMITS",
        "EDGE_CONNECTION",
        "EDGE_COMMUNICATION_FAILURE",
        "TASK_PROCESSING_FAILURE"
      ]
    },
    "configuration": {
      "$ref": "#/$defs/NotificationTemplateConfig"
    }
  },
  "required": [
    "configuration",
    "name",
    "notificationType"
  ],
  "$defs": {
    "Button": {
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "text": {
          "type": "string"
        },
        "linkType": {
          "type": "string",
          "enum": [
            "LINK",
            "DASHBOARD"
          ]
        },
        "link": {
          "type": "string"
        },
        "dashboardId": {
          "type": "string",
          "format": "uuid"
        },
        "dashboardState": {
          "type": "string"
        },
        "setEntityIdInState": {
          "type": "boolean"
        }
      }
    },
    "DeliveryMethodNotificationTemplate": {
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "body": {
          "type": "string"
        },
        "method": {
          "type": "string"
        }
      },
      "required": [
        "body",
        "method"
      ]
    },
    "EmailDeliveryMethodNotificationTemplate": {
      "allOf": [
        {
          "$ref": "#/$defs/DeliveryMethodNotificationTemplate"
        },
        {
          "type": "object",
          "properties": {
            "subject": {
              "type": "string"
            }
          }
        }
      ],
      "required": [
        "body",
        "subject"
      ]
    },
    "MicrosoftTeamsDeliveryMethodNotificationTemplate": {
      "allOf": [
        {
          "$ref": "#/$defs/DeliveryMethodNotificationTemplate"
        },
        {
          "type": "object",
          "properties": {
            "subject": {
              "type": "string"
            },
            "themeColor": {
              "type": "string"
            },
            "button": {
              "$ref": "#/$defs/Button"
            }
          }
        }
      ],
      "required": [
        "body"
      ]
    },
    "MobileAppDeliveryMethodNotificationTemplate": {
      "allOf": [
        {
          "$ref": "#/$defs/DeliveryMethodNotificationTemplate"
        },
        {
          "type": "object",
          "properties": {
            "subject": {
              "type": "string"
            },
            "additionalConfig": {}
          }
        }
      ],
      "required": [
        "body",
        "subject"
      ]
    },
    "NotificationTemplateConfig": {
      "properties": {
        "deliveryMethodsTemplates": {
          "type": "object",
          "additionalProperties": {
            "oneOf": [
              {
                "$ref": "#/$defs/EmailDeliveryMethodNotificationTemplate"
              },
              {
                "$ref": "#/$defs/MicrosoftTeamsDeliveryMethodNotificationTemplate"
              },
              {
                "$ref": "#/$defs/MobileAppDeliveryMethodNotificationTemplate"
              },
              {
                "$ref": "#/$defs/SlackDeliveryMethodNotificationTemplate"
              },
              {
                "$ref": "#/$defs/SmsDeliveryMethodNotificationTemplate"
              },
              {
                "$ref": "#/$defs/WebDeliveryMethodNotificationTemplate"
              }
            ]
          }
        }
      },
      "required": [
        "deliveryMethodsTemplates"
      ]
    },
    "NotificationTemplateId": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "ID of the entity, time-based UUID v1"
        },
        "entityType": {
          "type": "string",
          "description": "string",
          "enum": [
            "NOTIFICATION_TEMPLATE"
          ]
        }
      },
      "required": [
        "entityType",
        "id"
      ]
    },
    "SlackDeliveryMethodNotificationTemplate": {
      "allOf": [
        {
          "$ref": "#/$defs/DeliveryMethodNotificationTemplate"
        }
      ],
      "required": [
        "body"
      ]
    },
    "SmsDeliveryMethodNotificationTemplate": {
      "allOf": [
        {
          "$ref": "#/$defs/DeliveryMethodNotificationTemplate"
        }
      ],
      "required": [
        "body"
      ]
    },
    "TenantId": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "ID of the entity, time-based UUID v1"
        },
        "entityType": {
          "type": "string",
          "description": "string",
          "enum": [
            "TENANT"
          ]
        }
      },
      "required": [
        "entityType",
        "id"
      ]
    },
    "WebDeliveryMethodNotificationTemplate": {
      "allOf": [
        {
          "$ref": "#/$defs/DeliveryMethodNotificationTemplate"
        },
        {
          "type": "object",
          "properties": {
            "subject": {
              "type": "string"
            },
            "additionalConfig": {}
          }
        }
      ],
      "required": [
        "body",
        "subject"
      ]
    }
  }
}