Coverage for src / lexigram / contracts / notification / types.py: 100%
20 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-19 05:41 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-19 05:41 +0800
1# lexigram-contracts/src/lexigram/contracts/notification/types.py
2"""Notification value types."""
4from __future__ import annotations
6from dataclasses import dataclass, field
7from typing import Any
10@dataclass(frozen=True)
11class SMSMessage:
12 """An SMS notification message.
14 Attributes:
15 to: List of E.164-format recipient phone numbers.
16 body: SMS body text (max 1600 chars; providers split if needed).
17 from_number: Sender ID or phone number; backend default when ``None``.
18 metadata: Opaque provider-specific metadata.
19 """
21 to: list[str]
22 body: str
23 from_number: str | None = None
24 metadata: dict[str, str] = field(default_factory=dict)
27@dataclass(frozen=True)
28class PushMessage:
29 """A push notification message.
31 Attributes:
32 to: List of device tokens (FCM registration IDs, APNS tokens, etc.).
33 title: Notification title.
34 body: Notification body text.
35 data: Custom key-value payload delivered to the app.
36 badge: iOS badge count; ``None`` leaves badge unchanged.
37 sound: Notification sound name; ``None`` uses OS default.
38 image: URL of a large notification image.
39 ttl: Time-to-live in seconds; ``None`` uses provider default.
40 """
42 to: list[str]
43 title: str
44 body: str
45 data: dict[str, Any] = field(default_factory=dict)
46 badge: int | None = None
47 sound: str | None = None
48 image: str | None = None
49 ttl: int | None = None
52__all__ = ["PushMessage", "SMSMessage"]