S
StockBud Docs

StockBud.io Notifications Schema

Schema for notification and alert systems in StockBud.io

🔔 StockBud.io Notifications Schema

Version: 1.0.0

Schema for notification and alert systems in StockBud.io

Overview

This schema defines 7 data structures:


Definitions

Notification

Base notification structure

Properties

PropertyTypeRequiredDescription
idstringUnique notification identifier
typeenum: 'trade_execution', 'order_status', 'portfolio_alert', 'market_alert', 'system_alert', 'performance_update', 'risk_warning', 'news_update', 'strategy_signal', 'compliance_alert'Notification type
titlestringNotification title
messagestringNotification message content
priorityenum: 'low', 'normal', 'high', 'urgent', 'critical'Notification priority level
severityenum: 'info', 'warning', 'error', 'critical'Notification severity
categoryenum: 'trading', 'portfolio', 'market', 'system', 'compliance', 'performance'Notification category
sourcestringSource system or component
user_idstringTarget user identifier
account_idstringRelated account identifier
symbolsArray<string>Related stock symbols
metadataobjectAdditional notification metadata
actionsArray<NotificationAction>Available actions for the notification
channelsArray<string>Delivery channels
delivery_statusobjectDelivery status by channel
readbooleanWhether notification has been read
read_atstringWhen notification was read
acknowledgedbooleanWhether notification has been acknowledged
acknowledged_atstringWhen notification was acknowledged
acknowledged_bystringWho acknowledged the notification
expires_atstringNotification expiration timestamp
timestampstringNotification creation timestamp

TypeScript

interface Notification {
  /** Unique notification identifier */
  id: string;
  /** Notification type */
  type: "trade_execution" | "order_status" | "portfolio_alert" | "market_alert" | "system_alert" | "performance_update" | "risk_warning" | "news_update" | "strategy_signal" | "compliance_alert";
  /** Notification title */
  title: string;
  /** Notification message content */
  message: string;
  /** Notification priority level */
  priority: "low" | "normal" | "high" | "urgent" | "critical";
  /** Notification severity */
  severity?: "info" | "warning" | "error" | "critical";
  /** Notification category */
  category?: "trading" | "portfolio" | "market" | "system" | "compliance" | "performance";
  /** Source system or component */
  source?: string;
  /** Target user identifier */
  user_id?: string;
  /** Related account identifier */
  account_id?: string;
  /** Related stock symbols */
  symbols?: string[];
  /** Additional notification metadata */
  metadata?: Record<string, unknown>;
  /** Available actions for the notification */
  actions?: NotificationAction[];
  /** Delivery channels */
  channels?: string[];
  /** Delivery status by channel */
  delivery_status?: Record<string, unknown>;
  /** Whether notification has been read */
  read?: boolean;
  /** When notification was read */
  read_at?: string;
  /** Whether notification has been acknowledged */
  acknowledged?: boolean;
  /** When notification was acknowledged */
  acknowledged_at?: string;
  /** Who acknowledged the notification */
  acknowledged_by?: string;
  /** Notification expiration timestamp */
  expires_at?: string;
  /** Notification creation timestamp */
  timestamp: string;
}

NotificationAction

Action that can be taken on a notification

Properties

PropertyTypeRequiredDescription
idstringAction identifier
labelstringAction label for display
action_typeenum: 'acknowledge', 'dismiss', 'view_details', 'execute_trade', 'modify_order', 'cancel_order', 'view_portfolio', 'contact_support'Type of action
urlstringURL for action execution
methodenum: 'GET', 'POST', 'PUT', 'DELETE'HTTP method for action
payloadobjectPayload for action execution
confirmation_requiredbooleanWhether action requires confirmation

TypeScript

interface NotificationAction {
  /** Action identifier */
  id: string;
  /** Action label for display */
  label: string;
  /** Type of action */
  action_type: "acknowledge" | "dismiss" | "view_details" | "execute_trade" | "modify_order" | "cancel_order" | "view_portfolio" | "contact_support";
  /** URL for action execution */
  url?: string;
  /** HTTP method for action */
  method?: "GET" | "POST" | "PUT" | "DELETE";
  /** Payload for action execution */
  payload?: Record<string, unknown>;
  /** Whether action requires confirmation */
  confirmation_required?: boolean;
}

NotificationTemplate

Template for generating notifications

Properties

PropertyTypeRequiredDescription
idstringTemplate identifier
namestringTemplate name
typestringNotification type this template applies to
title_templatestringTitle template with placeholders
message_templatestringMessage template with placeholders
variablesArray<Record<string, unknown>>Template variables
channelsArray<string>Supported delivery channels
channel_templatesobjectChannel-specific templates
priority_rulesArray<Record<string, unknown>>Rules for determining notification priority
enabledbooleanWhether template is enabled
created_atstringTemplate creation timestamp
updated_atstringLast update timestamp

TypeScript

interface NotificationTemplate {
  /** Template identifier */
  id: string;
  /** Template name */
  name: string;
  /** Notification type this template applies to */
  type: string;
  /** Title template with placeholders */
  title_template: string;
  /** Message template with placeholders */
  message_template: string;
  /** Template variables */
  variables?: Record<string, unknown>[];
  /** Supported delivery channels */
  channels?: string[];
  /** Channel-specific templates */
  channel_templates?: Record<string, unknown>;
  /** Rules for determining notification priority */
  priority_rules?: Record<string, unknown>[];
  /** Whether template is enabled */
  enabled?: boolean;
  /** Template creation timestamp */
  created_at?: string;
  /** Last update timestamp */
  updated_at?: string;
}

NotificationRule

Rule for automated notification generation

Properties

PropertyTypeRequiredDescription
idstringRule identifier
namestringRule name
descriptionstringRule description
triggerobjectTrigger conditions for the rule
template_idstringNotification template to use
target_usersArray<string>Target user IDs
target_groupsArray<string>Target user groups
channelsArray<string>Delivery channels for this rule
scheduleobjectSchedule restrictions for notifications
rate_limitingobjectRate limiting configuration
enabledbooleanWhether rule is enabled
created_atstringRule creation timestamp
updated_atstringLast update timestamp

TypeScript

interface NotificationRule {
  /** Rule identifier */
  id: string;
  /** Rule name */
  name: string;
  /** Rule description */
  description?: string;
  /** Trigger conditions for the rule */
  trigger: Record<string, unknown>;
  /** Notification template to use */
  template_id: string;
  /** Target user IDs */
  target_users?: string[];
  /** Target user groups */
  target_groups?: string[];
  /** Delivery channels for this rule */
  channels?: string[];
  /** Schedule restrictions for notifications */
  schedule?: Record<string, unknown>;
  /** Rate limiting configuration */
  rate_limiting?: Record<string, unknown>;
  /** Whether rule is enabled */
  enabled: boolean;
  /** Rule creation timestamp */
  created_at?: string;
  /** Last update timestamp */
  updated_at?: string;
}

NotificationPreferences

User notification preferences

Properties

PropertyTypeRequiredDescription
user_idstringUser identifier
global_enabledbooleanGlobal notification toggle
channelsobjectChannel-specific preferences
notification_typesobjectPreferences by notification type
quiet_hoursobjectQuiet hours configuration
digestobjectDigest notification preferences
updated_atstringLast update timestamp

TypeScript

interface NotificationPreferences {
  /** User identifier */
  user_id: string;
  /** Global notification toggle */
  global_enabled?: boolean;
  /** Channel-specific preferences */
  channels?: Record<string, unknown>;
  /** Preferences by notification type */
  notification_types?: Record<string, unknown>;
  /** Quiet hours configuration */
  quiet_hours?: Record<string, unknown>;
  /** Digest notification preferences */
  digest?: Record<string, unknown>;
  /** Last update timestamp */
  updated_at?: string;
}

NotificationDelivery

Notification delivery record

Properties

PropertyTypeRequiredDescription
idstringDelivery record identifier
notification_idstringAssociated notification identifier
channelenum: 'email', 'sms', 'push', 'slack', 'discord', 'webhook'Delivery channel
recipientstringRecipient identifier or address
statusenum: 'pending', 'sent', 'delivered', 'failed', 'bounced', 'rejected'Delivery status
attemptsintegerNumber of delivery attempts
max_attemptsintegerMaximum delivery attempts
next_retrystringNext retry timestamp
provider_idstringProvider-specific message ID
provider_responseobjectProvider response data
errorstringError message if delivery failed
delivered_atstringDelivery timestamp
timestampstringRecord creation timestamp

TypeScript

interface NotificationDelivery {
  /** Delivery record identifier */
  id: string;
  /** Associated notification identifier */
  notification_id: string;
  /** Delivery channel */
  channel: "email" | "sms" | "push" | "slack" | "discord" | "webhook";
  /** Recipient identifier or address */
  recipient?: string;
  /** Delivery status */
  status: "pending" | "sent" | "delivered" | "failed" | "bounced" | "rejected";
  /** Number of delivery attempts */
  attempts?: number;
  /** Maximum delivery attempts */
  max_attempts?: number;
  /** Next retry timestamp */
  next_retry?: string;
  /** Provider-specific message ID */
  provider_id?: string;
  /** Provider response data */
  provider_response?: Record<string, unknown>;
  /** Error message if delivery failed */
  error?: string;
  /** Delivery timestamp */
  delivered_at?: string;
  /** Record creation timestamp */
  timestamp: string;
}

NotificationDigest

Digest of multiple notifications

Properties

PropertyTypeRequiredDescription
idstringDigest identifier
user_idstringTarget user identifier
period_startstringDigest period start
period_endstringDigest period end
notificationsArray<Notification>Notifications included in digest
summaryobjectDigest summary statistics
generated_atstringDigest generation timestamp
sent_atstringDigest send timestamp

TypeScript

interface NotificationDigest {
  /** Digest identifier */
  id: string;
  /** Target user identifier */
  user_id: string;
  /** Digest period start */
  period_start: string;
  /** Digest period end */
  period_end: string;
  /** Notifications included in digest */
  notifications: Notification[];
  /** Digest summary statistics */
  summary?: Record<string, unknown>;
  /** Digest generation timestamp */
  generated_at?: string;
  /** Digest send timestamp */
  sent_at?: string;
}

Usage Example

import type { Notification, NotificationAction, NotificationTemplate, NotificationRule, NotificationPreferences, NotificationDelivery, NotificationDigest } from '@stockbud/schemas';
 
// Create a new Notification
const example: Notification = {
  id: "example-value",
  type: "example-value",
  title: "example-value",
  message: "example-value",
  priority: "example-value",
};

Full JSON Schema

Click to expand raw JSON Schema
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "StockBud.io Notifications Schema",
  "description": "Schema for notification and alert systems in StockBud.io",
  "version": "1.0.0",
  "type": "object",
  "definitions": {
    "Notification": {
      "type": "object",
      "description": "Base notification structure",
      "required": [
        "id",
        "type",
        "title",
        "message",
        "priority",
        "timestamp"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique notification identifier"
        },
        "type": {
          "type": "string",
          "enum": [
            "trade_execution",
            "order_status",
            "portfolio_alert",
            "market_alert",
            "system_alert",
            "performance_update",
            "risk_warning",
            "news_update",
            "strategy_signal",
            "compliance_alert"
          ],
          "description": "Notification type"
        },
        "title": {
          "type": "string",
          "description": "Notification title"
        },
        "message": {
          "type": "string",
          "description": "Notification message content"
        },
        "priority": {
          "type": "string",
          "enum": [
            "low",
            "normal",
            "high",
            "urgent",
            "critical"
          ],
          "description": "Notification priority level"
        },
        "severity": {
          "type": "string",
          "enum": [
            "info",
            "warning",
            "error",
            "critical"
          ],
          "description": "Notification severity"
        },
        "category": {
          "type": "string",
          "enum": [
            "trading",
            "portfolio",
            "market",
            "system",
            "compliance",
            "performance"
          ],
          "description": "Notification category"
        },
        "source": {
          "type": "string",
          "description": "Source system or component"
        },
        "user_id": {
          "type": "string",
          "description": "Target user identifier"
        },
        "account_id": {
          "type": "string",
          "description": "Related account identifier"
        },
        "symbols": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Related stock symbols"
        },
        "metadata": {
          "type": "object",
          "description": "Additional notification metadata"
        },
        "actions": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/NotificationAction"
          },
          "description": "Available actions for the notification"
        },
        "channels": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "email",
              "sms",
              "push",
              "slack",
              "discord",
              "webhook"
            ]
          },
          "description": "Delivery channels"
        },
        "delivery_status": {
          "type": "object",
          "patternProperties": {
            "^(email|sms|push|slack|discord|webhook)$": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "sent",
                    "delivered",
                    "failed",
                    "bounced"
                  ]
                },
                "timestamp": {
                  "type": "string",
                  "format": "date-time"
                },
                "error": {
                  "type": "string"
                }
              }
            }
          },
          "description": "Delivery status by channel"
        },
        "read": {
          "type": "boolean",
          "default": false,
          "description": "Whether notification has been read"
        },
        "read_at": {
          "type": "string",
          "format": "date-time",
          "description": "When notification was read"
        },
        "acknowledged": {
          "type": "boolean",
          "default": false,
          "description": "Whether notification has been acknowledged"
        },
        "acknowledged_at": {
          "type": "string",
          "format": "date-time",
          "description": "When notification was acknowledged"
        },
        "acknowledged_by": {
          "type": "string",
          "description": "Who acknowledged the notification"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time",
          "description": "Notification expiration timestamp"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Notification creation timestamp"
        }
      }
    },
    "NotificationAction": {
      "type": "object",
      "description": "Action that can be taken on a notification",
      "required": [
        "id",
        "label",
        "action_type"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Action identifier"
        },
        "label": {
          "type": "string",
          "description": "Action label for display"
        },
        "action_type": {
          "type": "string",
          "enum": [
            "acknowledge",
            "dismiss",
            "view_details",
            "execute_trade",
            "modify_order",
            "cancel_order",
            "view_portfolio",
            "contact_support"
          ],
          "description": "Type of action"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "URL for action execution"
        },
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "POST",
            "PUT",
            "DELETE"
          ],
          "description": "HTTP method for action"
        },
        "payload": {
          "type": "object",
          "description": "Payload for action execution"
        },
        "confirmation_required": {
          "type": "boolean",
          "default": false,
          "description": "Whether action requires confirmation"
        }
      }
    },
    "NotificationTemplate": {
      "type": "object",
      "description": "Template for generating notifications",
      "required": [
        "id",
        "name",
        "type",
        "title_template",
        "message_template"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Template identifier"
        },
        "name": {
          "type": "string",
          "description": "Template name"
        },
        "type": {
          "type": "string",
          "description": "Notification type this template applies to"
        },
        "title_template": {
          "type": "string",
          "description": "Title template with placeholders"
        },
        "message_template": {
          "type": "string",
          "description": "Message template with placeholders"
        },
        "variables": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "string",
                  "number",
                  "boolean",
                  "date"
                ]
              },
              "required": {
                "type": "boolean"
              },
              "default": {
                "type": [
                  "string",
                  "number",
                  "boolean"
                ]
              }
            }
          },
          "description": "Template variables"
        },
        "channels": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Supported delivery channels"
        },
        "channel_templates": {
          "type": "object",
          "patternProperties": {
            "^(email|sms|push|slack|discord)$": {
              "type": "object",
              "properties": {
                "subject": {
                  "type": "string"
                },
                "body": {
                  "type": "string"
                },
                "format": {
                  "type": "string",
                  "enum": [
                    "text",
                    "html",
                    "markdown"
                  ]
                }
              }
            }
          },
          "description": "Channel-specific templates"
        },
        "priority_rules": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "condition": {
                "type": "string"
              },
              "priority": {
                "type": "string",
                "enum": [
                  "low",
                  "normal",
                  "high",
                  "urgent",
                  "critical"
                ]
              }
            }
          },
          "description": "Rules for determining notification priority"
        },
        "enabled": {
          "type": "boolean",
          "default": true,
          "description": "Whether template is enabled"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "Template creation timestamp"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "description": "Last update timestamp"
        }
      }
    },
    "NotificationRule": {
      "type": "object",
      "description": "Rule for automated notification generation",
      "required": [
        "id",
        "name",
        "trigger",
        "template_id",
        "enabled"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Rule identifier"
        },
        "name": {
          "type": "string",
          "description": "Rule name"
        },
        "description": {
          "type": "string",
          "description": "Rule description"
        },
        "trigger": {
          "type": "object",
          "properties": {
            "event_type": {
              "type": "string"
            },
            "conditions": {
              "type": "array",
              "items": {
                "type": "object"
              }
            },
            "aggregation": {
              "type": "string",
              "enum": [
                "any",
                "all"
              ]
            },
            "cooldown_minutes": {
              "type": "integer",
              "minimum": 0
            }
          },
          "description": "Trigger conditions for the rule"
        },
        "template_id": {
          "type": "string",
          "description": "Notification template to use"
        },
        "target_users": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Target user IDs"
        },
        "target_groups": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Target user groups"
        },
        "channels": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Delivery channels for this rule"
        },
        "schedule": {
          "type": "object",
          "properties": {
            "active_hours": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "active_days": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "timezone": {
              "type": "string"
            },
            "quiet_hours": {
              "type": "object",
              "properties": {
                "start": {
                  "type": "string",
                  "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"
                },
                "end": {
                  "type": "string",
                  "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"
                }
              }
            }
          },
          "description": "Schedule restrictions for notifications"
        },
        "rate_limiting": {
          "type": "object",
          "properties": {
            "max_per_minute": {
              "type": "integer"
            },
            "max_per_hour": {
              "type": "integer"
            },
            "max_per_day": {
              "type": "integer"
            }
          },
          "description": "Rate limiting configuration"
        },
        "enabled": {
          "type": "boolean",
          "description": "Whether rule is enabled"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "Rule creation timestamp"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "description": "Last update timestamp"
        }
      }
    },
    "NotificationPreferences": {
      "type": "object",
      "description": "User notification preferences",
      "required": [
        "user_id"
      ],
      "properties": {
        "user_id": {
          "type": "string",
          "description": "User identifier"
        },
        "global_enabled": {
          "type": "boolean",
          "default": true,
          "description": "Global notification toggle"
        },
        "channels": {
          "type": "object",
          "properties": {
            "email": {
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean"
                },
                "address": {
                  "type": "string",
                  "format": "email"
                },
                "verified": {
                  "type": "boolean"
                }
              }
            },
            "sms": {
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean"
                },
                "phone_number": {
                  "type": "string"
                },
                "verified": {
                  "type": "boolean"
                }
              }
            },
            "push": {
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean"
                },
                "device_tokens": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            },
            "slack": {
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean"
                },
                "webhook_url": {
                  "type": "string",
                  "format": "uri"
                },
                "channel": {
                  "type": "string"
                }
              }
            },
            "discord": {
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean"
                },
                "webhook_url": {
                  "type": "string",
                  "format": "uri"
                },
                "channel": {
                  "type": "string"
                }
              }
            }
          },
          "description": "Channel-specific preferences"
        },
        "notification_types": {
          "type": "object",
          "patternProperties": {
            "^[a-z_]+$": {
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean"
                },
                "channels": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "priority_threshold": {
                  "type": "string",
                  "enum": [
                    "low",
                    "normal",
                    "high",
                    "urgent",
                    "critical"
                  ]
                }
              }
            }
          },
          "description": "Preferences by notification type"
        },
        "quiet_hours": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "start": {
              "type": "string",
              "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"
            },
            "end": {
              "type": "string",
              "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"
            },
            "timezone": {
              "type": "string"
            },
            "emergency_override": {
              "type": "boolean"
            }
          },
          "description": "Quiet hours configuration"
        },
        "digest": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "frequency": {
              "type": "string",
              "enum": [
                "daily",
                "weekly",
                "monthly"
              ]
            },
            "time": {
              "type": "string",
              "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"
            },
            "day_of_week": {
              "type": "integer",
              "minimum": 0,
              "maximum": 6
            },
            "include_types": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "description": "Digest notification preferences"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "description": "Last update timestamp"
        }
      }
    },
    "NotificationDelivery": {
      "type": "object",
      "description": "Notification delivery record",
      "required": [
        "id",
        "notification_id",
        "channel",
        "status",
        "timestamp"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Delivery record identifier"
        },
        "notification_id": {
          "type": "string",
          "description": "Associated notification identifier"
        },
        "channel": {
          "type": "string",
          "enum": [
            "email",
            "sms",
            "push",
            "slack",
            "discord",
            "webhook"
          ],
          "description": "Delivery channel"
        },
        "recipient": {
          "type": "string",
          "description": "Recipient identifier or address"
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "sent",
            "delivered",
            "failed",
            "bounced",
            "rejected"
          ],
          "description": "Delivery status"
        },
        "attempts": {
          "type": "integer",
          "minimum": 0,
          "description": "Number of delivery attempts"
        },
        "max_attempts": {
          "type": "integer",
          "minimum": 1,
          "default": 3,
          "description": "Maximum delivery attempts"
        },
        "next_retry": {
          "type": "string",
          "format": "date-time",
          "description": "Next retry timestamp"
        },
        "provider_id": {
          "type": "string",
          "description": "Provider-specific message ID"
        },
        "provider_response": {
          "type": "object",
          "description": "Provider response data"
        },
        "error": {
          "type": "string",
          "description": "Error message if delivery failed"
        },
        "delivered_at": {
          "type": "string",
          "format": "date-time",
          "description": "Delivery timestamp"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Record creation timestamp"
        }
      }
    },
    "NotificationDigest": {
      "type": "object",
      "description": "Digest of multiple notifications",
      "required": [
        "id",
        "user_id",
        "period_start",
        "period_end",
        "notifications"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Digest identifier"
        },
        "user_id": {
          "type": "string",
          "description": "Target user identifier"
        },
        "period_start": {
          "type": "string",
          "format": "date-time",
          "description": "Digest period start"
        },
        "period_end": {
          "type": "string",
          "format": "date-time",
          "description": "Digest period end"
        },
        "notifications": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Notification"
          },
          "description": "Notifications included in digest"
        },
        "summary": {
          "type": "object",
          "properties": {
            "total_count": {
              "type": "integer"
            },
            "by_type": {
              "type": "object"
            },
            "by_priority": {
              "type": "object"
            },
            "unread_count": {
              "type": "integer"
            }
          },
          "description": "Digest summary statistics"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time",
          "description": "Digest generation timestamp"
        },
        "sent_at": {
          "type": "string",
          "format": "date-time",
          "description": "Digest send timestamp"
        }
      }
    }
  },
  "properties": {
    "notifications": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Notification"
      }
    },
    "templates": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/NotificationTemplate"
      }
    },
    "rules": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/NotificationRule"
      }
    },
    "preferences": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/NotificationPreferences"
      }
    },
    "deliveries": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/NotificationDelivery"
      }
    },
    "digests": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/NotificationDigest"
      }
    }
  }
}