data_modelling_core/models/enums.rs
1//! Enums for data modeling
2//!
3//! # Serde Casing Conventions
4//!
5//! The enums in this module use different serde `rename_all` strategies based on their
6//! semantic meaning and external schema requirements:
7//!
8//! - `SCREAMING_SNAKE_CASE`: Technical/database constants (DatabaseType, SCDPattern)
9//! - `lowercase`: Simple layer/level keywords (MedallionLayer, ModelingLevel)
10//! - `PascalCase`: Type names and relationships (Cardinality, RelationshipType, InfrastructureType)
11//! - No rename: Values that match Rust conventions (DataVaultClassification)
12//!
13//! These conventions ensure compatibility with ODCS, CADS, and other external schemas.
14
15use serde::{Deserialize, Serialize};
16
17#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
18#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
19pub enum DatabaseType {
20 DatabricksDelta,
21 DatabricksIceberg,
22 AwsGlue,
23 DatabricksLakebase,
24 Postgres,
25 Mysql,
26 SqlServer,
27 Dynamodb,
28 Cassandra,
29 Kafka,
30 Pulsar,
31}
32
33#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
34#[serde(rename_all = "lowercase")]
35pub enum MedallionLayer {
36 Bronze,
37 Silver,
38 Gold,
39 Operational,
40}
41
42#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
43#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
44pub enum SCDPattern {
45 Type1,
46 Type2,
47}
48
49#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
50pub enum DataVaultClassification {
51 Hub,
52 Link,
53 Satellite,
54}
55
56#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
57#[serde(rename_all = "lowercase")]
58pub enum ModelingLevel {
59 Conceptual,
60 Logical,
61 Physical,
62}
63
64/// Legacy cardinality enum (for backward compatibility)
65/// Consider using EndpointCardinality for more precise crow's feet notation
66#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
67#[serde(rename_all = "camelCase")]
68pub enum Cardinality {
69 OneToOne,
70 OneToMany,
71 ManyToOne,
72 ManyToMany,
73}
74
75/// Crow's feet notation endpoint cardinality
76///
77/// Defines the cardinality at one end of a relationship using standard
78/// crow's feet notation symbols:
79/// - ZeroOrOne: Optional single (0..1) - circle with single line
80/// - ExactlyOne: Required single (1..1) - single line with perpendicular bar
81/// - ZeroOrMany: Optional multiple (0..*) - circle with crow's foot
82/// - OneOrMany: Required multiple (1..*) - perpendicular bar with crow's foot
83#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
84#[serde(rename_all = "camelCase")]
85pub enum EndpointCardinality {
86 /// Zero or one (optional single) - 0..1
87 ZeroOrOne,
88 /// Exactly one (required single) - 1..1
89 ExactlyOne,
90 /// Zero or many (optional multiple) - 0..*
91 ZeroOrMany,
92 /// One or many (required multiple) - 1..*
93 OneOrMany,
94}
95
96/// Flow direction for data flow relationships
97///
98/// Defines the direction of data movement between nodes
99#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
100#[serde(rename_all = "camelCase")]
101pub enum FlowDirection {
102 /// Data flows from source to target only
103 SourceToTarget,
104 /// Data flows from target to source only
105 TargetToSource,
106 /// Data flows in both directions
107 Bidirectional,
108}
109
110#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
111#[serde(rename_all = "camelCase")]
112pub enum RelationshipType {
113 DataFlow,
114 Dependency,
115 ForeignKey,
116 /// ETL transformation (maps to "etl" in JSON)
117 #[serde(rename = "etl")]
118 EtlTransformation,
119}
120
121/// Authentication method for system connections
122///
123/// Defines the authentication method used to connect to a system.
124/// Used in EnvironmentConnection to specify how to authenticate
125/// with different environments.
126#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
127#[serde(rename_all = "camelCase")]
128pub enum AuthMethod {
129 /// OAuth 2.0 authentication
130 OAuth2,
131 /// API key authentication
132 ApiKey,
133 /// AWS IAM role authentication
134 IamRole,
135 /// Certificate-based authentication
136 Certificate,
137 /// Basic username/password authentication
138 BasicAuth,
139 /// SAML authentication
140 Saml,
141 /// OpenID Connect authentication
142 Oidc,
143 /// Kerberos authentication
144 Kerberos,
145 /// AWS Signature Version 4
146 AwsSignatureV4,
147 /// GCP Service Account authentication
148 GcpServiceAccount,
149 /// Azure Active Directory authentication
150 AzureActiveDirectory,
151 /// Mutual TLS authentication
152 Mtls,
153 /// No authentication required
154 None,
155 /// Custom authentication method
156 Custom,
157}
158
159/// Status of an environment
160///
161/// Defines the current operational status of a system environment.
162/// Used in EnvironmentConnection to indicate whether an environment
163/// is active, being deprecated, under maintenance, or inactive.
164#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
165#[serde(rename_all = "camelCase")]
166pub enum EnvironmentStatus {
167 /// Environment is active and available for use
168 #[default]
169 Active,
170 /// Environment is deprecated and will be removed
171 Deprecated,
172 /// Environment is under maintenance
173 Maintenance,
174 /// Environment is inactive and not available
175 Inactive,
176}
177
178/// Infrastructure type for Data Flow nodes and relationships
179///
180/// Comprehensive enumeration covering major cloud databases, container platforms,
181/// data warehouses, message queues, BI/analytics tools, and storage systems
182/// from AWS, Azure, and GCP. Also used as SystemType for SystemReference.
183#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
184#[serde(rename_all = "PascalCase")]
185pub enum InfrastructureType {
186 // Traditional Databases
187 PostgreSQL,
188 MySQL,
189 Mssql,
190 Oracle,
191 Sqlite,
192 MariaDB,
193 // NoSQL Databases
194 DynamoDB,
195 Cassandra,
196 MongoDB,
197 Redis,
198 ElasticSearch,
199 CouchDB,
200 Neo4j,
201 // AWS Services
202 RdsPostgreSQL,
203 RdsMySQL,
204 RdsMariaDB,
205 RdsOracle,
206 RdsSqlServer,
207 Redshift,
208 Aurora,
209 DocumentDB,
210 Neptune,
211 ElastiCache,
212 S3,
213 Eks,
214 Ecs,
215 Lambda,
216 Kinesis,
217 Sqs,
218 Sns,
219 Glue,
220 Athena,
221 QuickSight,
222 // Azure Services
223 AzureSqlDatabase,
224 CosmosDB,
225 AzureSynapseAnalytics,
226 AzureDataLakeStorage,
227 AzureBlobStorage,
228 Aks,
229 Aci,
230 AzureFunctions,
231 EventHubs,
232 ServiceBus,
233 AzureDataFactory,
234 PowerBI,
235 // GCP Services
236 CloudSqlPostgreSQL,
237 CloudSqlMySQL,
238 CloudSqlSqlServer,
239 BigQuery,
240 CloudSpanner,
241 Firestore,
242 CloudStorage,
243 Gke,
244 CloudRun,
245 CloudFunctions,
246 PubSub,
247 Dataflow,
248 Looker,
249 // Message Queues
250 Kafka,
251 Pulsar,
252 RabbitMQ,
253 ActiveMQ,
254 // Container Platforms
255 Kubernetes,
256 Docker,
257 // Data Warehouses
258 Snowflake,
259 Databricks,
260 Teradata,
261 Vertica,
262 // BI/Analytics Tools
263 Tableau,
264 Qlik,
265 Metabase,
266 ApacheSuperset,
267 Grafana,
268 // Other Storage
269 Hdfs,
270 MinIO,
271}