Skip to main content

backbone_integrations/exports/
types.rs

1//! Public types for Integrations module
2//!
3//! Generated by metaphor-schema. Do not edit manually.
4//!
5//! These DTOs are the ONLY types other modules should use.
6//! They are decoupled from internal domain entities.
7
8use serde::{Deserialize, Serialize};
9use uuid::Uuid;
10use chrono::{DateTime, Utc};
11use crate::domain::entity::*;
12
13// ============================================================================
14// INTEGRATIONCONNECTOR TYPES
15// ============================================================================
16
17/// Type-safe ID for IntegrationConnector
18///
19/// Use this instead of raw Uuid for type safety across modules.
20#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
21pub struct IntegrationConnectorId(pub Uuid);
22
23impl IntegrationConnectorId {
24    pub fn new(id: Uuid) -> Self {
25        Self(id)
26    }
27
28    pub fn into_inner(self) -> Uuid {
29        self.0
30    }
31}
32
33impl From<Uuid> for IntegrationConnectorId {
34    fn from(id: Uuid) -> Self {
35        Self(id)
36    }
37}
38
39impl From<IntegrationConnectorId> for Uuid {
40    fn from(id: IntegrationConnectorId) -> Self {
41        id.0
42    }
43}
44
45/// Data transfer object for IntegrationConnector
46///
47/// This is the public representation of IntegrationConnector for other modules.
48#[derive(Debug, Clone, Serialize, Deserialize)]
49pub struct IntegrationConnectorDto {
50    pub id: IntegrationConnectorId,
51    pub provider: String,
52    pub kind: ConnectorKind,
53    pub direction: ConnectorDirection,
54    pub status: ConnectorStatus,
55    pub metadata: serde_json::Value,
56}
57
58/// Summary view of IntegrationConnector for list displays
59#[derive(Debug, Clone, Serialize, Deserialize)]
60pub struct IntegrationConnectorSummary {
61    pub id: IntegrationConnectorId,
62    pub status: ConnectorStatus,
63}
64
65/// Reference to IntegrationConnector for foreign key relationships
66#[derive(Debug, Clone, Serialize, Deserialize)]
67pub struct IntegrationConnectorRef {
68    pub id: IntegrationConnectorId,
69}
70
71// ============================================================================
72// INTEGRATIONACCOUNT TYPES
73// ============================================================================
74
75/// Type-safe ID for IntegrationAccount
76///
77/// Use this instead of raw Uuid for type safety across modules.
78#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
79pub struct IntegrationAccountId(pub Uuid);
80
81impl IntegrationAccountId {
82    pub fn new(id: Uuid) -> Self {
83        Self(id)
84    }
85
86    pub fn into_inner(self) -> Uuid {
87        self.0
88    }
89}
90
91impl From<Uuid> for IntegrationAccountId {
92    fn from(id: Uuid) -> Self {
93        Self(id)
94    }
95}
96
97impl From<IntegrationAccountId> for Uuid {
98    fn from(id: IntegrationAccountId) -> Self {
99        id.0
100    }
101}
102
103/// Data transfer object for IntegrationAccount
104///
105/// This is the public representation of IntegrationAccount for other modules.
106#[derive(Debug, Clone, Serialize, Deserialize)]
107pub struct IntegrationAccountDto {
108    pub id: IntegrationAccountId,
109    pub provider: OAuthProvider,
110    pub account_ref: String,
111    pub status: IntegrationAccountStatus,
112    pub scopes: String,
113    pub pkce_verifier: Option<String>,
114    pub expires_at: Option<DateTime<Utc>>,
115    pub last_refreshed_at: Option<DateTime<Utc>>,
116    pub metadata: serde_json::Value,
117}
118
119/// Summary view of IntegrationAccount for list displays
120#[derive(Debug, Clone, Serialize, Deserialize)]
121pub struct IntegrationAccountSummary {
122    pub id: IntegrationAccountId,
123    pub status: IntegrationAccountStatus,
124}
125
126/// Reference to IntegrationAccount for foreign key relationships
127#[derive(Debug, Clone, Serialize, Deserialize)]
128pub struct IntegrationAccountRef {
129    pub id: IntegrationAccountId,
130}
131
132// ============================================================================
133// INTEGRATIONEVENT TYPES
134// ============================================================================
135
136/// Type-safe ID for IntegrationEvent
137///
138/// Use this instead of raw Uuid for type safety across modules.
139#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
140pub struct IntegrationEventId(pub Uuid);
141
142impl IntegrationEventId {
143    pub fn new(id: Uuid) -> Self {
144        Self(id)
145    }
146
147    pub fn into_inner(self) -> Uuid {
148        self.0
149    }
150}
151
152impl From<Uuid> for IntegrationEventId {
153    fn from(id: Uuid) -> Self {
154        Self(id)
155    }
156}
157
158impl From<IntegrationEventId> for Uuid {
159    fn from(id: IntegrationEventId) -> Self {
160        id.0
161    }
162}
163
164/// Data transfer object for IntegrationEvent
165///
166/// This is the public representation of IntegrationEvent for other modules.
167#[derive(Debug, Clone, Serialize, Deserialize)]
168pub struct IntegrationEventDto {
169    pub id: IntegrationEventId,
170    pub connector_id: Uuid,
171    pub event_type: String,
172    pub external_id: String,
173    pub business_key: String,
174    pub status: IntegrationStatus,
175    pub payload: String,
176    pub mapped_ref_type: Option<String>,
177    pub mapped_ref_id: Option<Uuid>,
178    pub error_detail: Option<String>,
179    pub metadata: serde_json::Value,
180}
181
182/// Summary view of IntegrationEvent for list displays
183#[derive(Debug, Clone, Serialize, Deserialize)]
184pub struct IntegrationEventSummary {
185    pub id: IntegrationEventId,
186    pub status: IntegrationStatus,
187}
188
189/// Reference to IntegrationEvent for foreign key relationships
190#[derive(Debug, Clone, Serialize, Deserialize)]
191pub struct IntegrationEventRef {
192    pub id: IntegrationEventId,
193}
194
195// ============================================================================
196// CUSTOM TYPES
197// ============================================================================
198
199// <<< CUSTOM TYPES START >>>
200// Add custom public types here
201// <<< CUSTOM TYPES END >>>