{
    "$schema": "../../../../schemas/diagram-spec.schema.json",
    "schemaVersion": "1.0",
    "id": "data-platform",
    "title": "Event-driven data platform",
    "description": "Reference architecture for streaming ingestion, lakehouse processing, analytics, and platform observability.",
    "language": "en",
    "legend": [
        {
            "label": "Streaming path",
            "variant": "realtime"
        },
        {
            "label": "Managed data path",
            "variant": "delegated"
        },
        {
            "label": "Monitoring path",
            "variant": "external"
        }
    ],
    "nodes": [
        {
            "id": "producers",
            "type": "external-service",
            "variant": "external",
            "status": "stable",
            "title": "DATA\nPRODUCERS",
            "subtitle": "Apps and devices",
            "icon": "network"
        },
        {
            "id": "ingestion-api",
            "type": "api",
            "variant": "realtime",
            "status": "stable",
            "title": "INGESTION API",
            "subtitle": "Schema validation",
            "icon": "monitor"
        },
        {
            "id": "event-stream",
            "type": "event-bus",
            "variant": "realtime",
            "status": "stable",
            "title": "EVENT STREAM",
            "subtitle": "Durable topics",
            "icon": "queue"
        },
        {
            "id": "stream-processor",
            "type": "service",
            "variant": "realtime",
            "status": "stable",
            "title": "STREAM\nPROCESSOR",
            "subtitle": "Enrichment",
            "icon": "spark"
        },
        {
            "id": "raw-lake",
            "type": "storage",
            "variant": "delegated",
            "status": "stable",
            "title": "RAW DATA LAKE",
            "subtitle": "Immutable objects",
            "icon": "storage"
        },
        {
            "id": "warehouse",
            "type": "database",
            "variant": "delegated",
            "status": "stable",
            "title": "ANALYTICS\nWAREHOUSE",
            "subtitle": "Curated models",
            "icon": "database"
        },
        {
            "id": "analytics",
            "type": "client",
            "variant": "delegated",
            "status": "stable",
            "title": "BI / ANALYTICS",
            "subtitle": "Dashboards and SQL",
            "icon": "monitor"
        },
        {
            "id": "observability",
            "type": "observability",
            "variant": "external",
            "status": "stable",
            "title": "PLATFORM\nOPS",
            "subtitle": "Metrics and lineage",
            "icon": "waveform"
        }
    ],
    "edges": [
        {
            "id": "produce-events",
            "from": "producers",
            "to": "ingestion-api",
            "type": "event",
            "variant": "realtime",
            "label": "EVENTS",
            "direction": "forward",
            "protocol": "HTTPS"
        },
        {
            "id": "publish-events",
            "from": "ingestion-api",
            "to": "event-stream",
            "type": "event",
            "variant": "realtime",
            "label": "PUBLISH",
            "direction": "forward"
        },
        {
            "id": "consume-events",
            "from": "event-stream",
            "to": "stream-processor",
            "type": "realtime-stream",
            "variant": "realtime",
            "label": "CONSUME",
            "direction": "forward"
        },
        {
            "id": "archive-raw",
            "from": "stream-processor",
            "to": "raw-lake",
            "type": "data-write",
            "variant": "delegated",
            "label": "ARCHIVE",
            "direction": "forward"
        },
        {
            "id": "load-models",
            "from": "raw-lake",
            "to": "warehouse",
            "type": "batch",
            "variant": "delegated",
            "label": "TRANSFORM",
            "direction": "forward"
        },
        {
            "id": "serve-analytics",
            "from": "warehouse",
            "to": "analytics",
            "type": "data-read",
            "variant": "delegated",
            "label": "QUERY",
            "direction": "bidirectional",
            "protocol": "SQL"
        },
        {
            "id": "stream-to-warehouse",
            "from": "stream-processor",
            "to": "warehouse",
            "type": "data-write",
            "variant": "delegated",
            "label": "REAL-TIME LOAD",
            "direction": "forward"
        },
        {
            "id": "monitor-stream",
            "from": "stream-processor",
            "to": "observability",
            "type": "monitoring",
            "variant": "external",
            "label": "METRICS / LINEAGE",
            "direction": "forward"
        }
    ]
}
