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/// Infrastructure type for Data Flow nodes and relationships
122///
123/// Comprehensive enumeration covering major cloud databases, container platforms,
124/// data warehouses, message queues, BI/analytics tools, and storage systems
125/// from AWS, Azure, and GCP.
126#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
127#[serde(rename_all = "PascalCase")]
128pub enum InfrastructureType {
129    // Traditional Databases
130    PostgreSQL,
131    MySQL,
132    Mssql,
133    Oracle,
134    Sqlite,
135    MariaDB,
136    // NoSQL Databases
137    DynamoDB,
138    Cassandra,
139    MongoDB,
140    Redis,
141    ElasticSearch,
142    CouchDB,
143    Neo4j,
144    // AWS Services
145    RdsPostgreSQL,
146    RdsMySQL,
147    RdsMariaDB,
148    RdsOracle,
149    RdsSqlServer,
150    Redshift,
151    Aurora,
152    DocumentDB,
153    Neptune,
154    ElastiCache,
155    S3,
156    Eks,
157    Ecs,
158    Lambda,
159    Kinesis,
160    Sqs,
161    Sns,
162    Glue,
163    Athena,
164    QuickSight,
165    // Azure Services
166    AzureSqlDatabase,
167    CosmosDB,
168    AzureSynapseAnalytics,
169    AzureDataLakeStorage,
170    AzureBlobStorage,
171    Aks,
172    Aci,
173    AzureFunctions,
174    EventHubs,
175    ServiceBus,
176    AzureDataFactory,
177    PowerBI,
178    // GCP Services
179    CloudSqlPostgreSQL,
180    CloudSqlMySQL,
181    CloudSqlSqlServer,
182    BigQuery,
183    CloudSpanner,
184    Firestore,
185    CloudStorage,
186    Gke,
187    CloudRun,
188    CloudFunctions,
189    PubSub,
190    Dataflow,
191    Looker,
192    // Message Queues
193    Kafka,
194    Pulsar,
195    RabbitMQ,
196    ActiveMQ,
197    // Container Platforms
198    Kubernetes,
199    Docker,
200    // Data Warehouses
201    Snowflake,
202    Databricks,
203    Teradata,
204    Vertica,
205    // BI/Analytics Tools
206    Tableau,
207    Qlik,
208    Metabase,
209    ApacheSuperset,
210    Grafana,
211    // Other Storage
212    Hdfs,
213    MinIO,
214}