main
ts 111 lines 2.89 KB
Raw
1 // Notification routing — types mirror app/notifications/schema/notifications.py.
2 // Shuffle is the sole delivery channel; email, chat, ticketing, and the
3 // rest flow through Shuffle's catalog of authenticated apps.
4
5 // Trigger represents the *event type* that caused the dispatch — not
6 // a severity filter (severity gating lives in min_severity). Currently
7 // just the one Talon-driven event; will grow when we add hooks for
8 // analyst-review / IOC-enrichment / scheduled sweeps.
9 export type NotificationTrigger = "investigation_complete"
10
11 export type NotificationChannel = "shuffle"
12
13 export type NotificationSeverity = "Critical" | "High" | "Medium" | "Low" | "Informational"
14
15 export type DispatchStatus = "sent" | "failed" | "skipped"
16
17 export interface NotificationRoute {
18 id: number
19 customer_code: string
20 name: string
21 trigger: NotificationTrigger
22 channel: NotificationChannel
23 destination: string
24 min_severity: NotificationSeverity
25 format_template: string | null
26 enabled: boolean
27 last_dispatched_at: string | null
28 dispatch_count: number
29 created_by: string | null
30 created_at: string
31 updated_at: string | null
32 // Phase 2 — populated only when channel === "shuffle"
33 shuffle_integration_id: number | null
34 shuffle_app_id: string | null
35 shuffle_app_name: string | null
36 }
37
38 export interface NotificationRoutePayload {
39 name: string
40 trigger: NotificationTrigger
41 channel: NotificationChannel
42 destination: string
43 min_severity: NotificationSeverity
44 format_template?: string | null
45 enabled: boolean
46 shuffle_integration_id?: number | null
47 shuffle_app_id?: string | null
48 shuffle_app_name?: string | null
49 }
50
51 export type NotificationRouteUpdatePayload = Partial<NotificationRoutePayload>
52
53 export interface NotificationDispatchLogEntry {
54 id: number
55 customer_code: string
56 alert_id: number
57 route_id: number
58 trigger: string
59 dispatched_at: string
60 status: DispatchStatus
61 error_message: string | null
62 latency_ms: number | null
63 payload_preview: string | null
64 shuffle_execution_id: string | null
65 }
66
67 // ----- Shuffle integrations (Phase 2) -----
68
69 export interface ShuffleIntegration {
70 id: number
71 customer_code: string
72 display_name: string
73 shuffle_org_id: string
74 enabled: boolean
75 last_used_at: string | null
76 created_by: string | null
77 created_at: string
78 updated_at: string | null
79 }
80
81 export interface ShuffleIntegrationPayload {
82 display_name: string
83 shuffle_org_id: string
84 enabled: boolean
85 }
86
87 export type ShuffleIntegrationUpdatePayload = Partial<ShuffleIntegrationPayload>
88
89 export interface ShuffleApp {
90 id: string
91 name: string
92 description: string | null
93 large_image: string | null
94 }
95
96 export interface ShuffleOrg {
97 id: string
98 name: string
99 description: string | null
100 role: string | null
101 // Parent org UUID on sub-orgs, null/empty on top-level orgs.
102 creator_org: string | null
103 }
104
105 export interface ShuffleVerifyResult {
106 success: boolean
107 message: string
108 org_id: string
109 app_count: number | null
110 error: string | null
111 }