Coverage for src/lexigram/notification/types.py: 100%

28 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-26 02:32 +0800

1"""lexigram-notification type re-exports.""" 

2 

3from __future__ import annotations 

4 

5from dataclasses import dataclass 

6from enum import Enum 

7 

8from lexigram.contracts.mailer.types import ( 

9 Attachment, 

10 DeliveryState, 

11 EmailMessage, 

12 MessageAddress, 

13 MessageDeliveryReceipt, 

14 MessagePriority, 

15 MessageStatus, 

16) 

17from lexigram.contracts.notification.types import PushMessage, SMSMessage 

18 

19__all__ = [ 

20 "Attachment", 

21 "DeliveryState", 

22 "EmailMessage", 

23 "InboxMessageStatus", 

24 "InboxPageResult", 

25 "InboxQuery", 

26 "InboxStats", 

27 "MessageAddress", 

28 "MessageDeliveryReceipt", 

29 "MessagePriority", 

30 "MessageStatus", 

31 "PushMessage", 

32 "SMSMessage", 

33] 

34 

35 

36# === Inbox Types (merged from inbox/types.py) === 

37 

38 

39class InboxMessageStatus(str, Enum): 

40 """Status of an inbox message.""" 

41 

42 ARCHIVED = "archived" 

43 READ = "read" 

44 UNREAD = "unread" 

45 

46 

47@dataclass(frozen=True, kw_only=True) 

48class InboxQuery: 

49 """Parameters for paginated inbox message queries. 

50 

51 Attributes: 

52 user_id: Identifier of the user whose inbox to query. 

53 page: Page number (1-indexed). 

54 page_size: Number of results per page. 

55 unread_only: When True, return only unread messages. 

56 """ 

57 

58 user_id: str 

59 page: int = 1 

60 page_size: int = 20 

61 unread_only: bool = False 

62 

63 

64@dataclass(frozen=True, kw_only=True) 

65class InboxPageResult: 

66 """Paginated result of an inbox query. 

67 

68 Attributes: 

69 items: List of inbox message objects for this page. 

70 total: Total number of matching messages. 

71 page: Current page number. 

72 page_size: Number of items per page. 

73 has_next: Whether there is a next page. 

74 """ 

75 

76 items: list[object] 

77 total: int 

78 page: int 

79 page_size: int 

80 has_next: bool 

81 

82 

83@dataclass(frozen=True, kw_only=True) 

84class InboxStats: 

85 """Aggregate statistics for a user's inbox. 

86 

87 Attributes: 

88 user_id: Identifier of the user. 

89 total_count: Total number of messages in the inbox. 

90 unread_count: Number of unread messages. 

91 """ 

92 

93 user_id: str 

94 total_count: int 

95 unread_count: int