graph TB
    %% Production Environment Physical Architecture
    %% KT Event Marketing Service - Azure Cloud Enterprise Architecture

    Users[Mobile/Web Users<br/>초기 100명, 확장 10만명] --> CDN[Azure Front Door<br/>+ CDN]

    subgraph "Azure Cloud - Production Environment"
        CDN --> AppGateway[Application Gateway<br/>+ WAF v2<br/>Zone Redundant]

        subgraph "VNet (10.0.0.0/16)"
            subgraph "Gateway Subnet (10.0.5.0/24)"
                AppGateway
            end

            subgraph "Application Subnet (10.0.1.0/24)"
                subgraph "AKS Premium Cluster - Multi-Zone"
                    direction TB

                    subgraph "System Node Pool"
                        SystemNode1[System Node 1<br/>Zone 1<br/>D2s_v3]
                        SystemNode2[System Node 2<br/>Zone 2<br/>D2s_v3]
                        SystemNode3[System Node 3<br/>Zone 3<br/>D2s_v3]
                    end

                    subgraph "Application Node Pool"
                        AppNode1[App Node 1<br/>Zone 1<br/>D4s_v3]
                        AppNode2[App Node 2<br/>Zone 2<br/>D4s_v3]
                        AppNode3[App Node 3<br/>Zone 3<br/>D4s_v3]
                    end

                    subgraph "Application Services - 7 Microservices"
                        UserService[User Service<br/>Layered Arch<br/>3 replicas, HPA 2-10]
                        EventService[Event Service<br/>Clean Arch<br/>3 replicas, HPA 3-15]
                        AIService[AI Service<br/>Clean Arch<br/>2 replicas, HPA 2-8]
                        ContentService[Content Service<br/>Clean Arch<br/>2 replicas, HPA 2-8]
                        DistService[Distribution Service<br/>Layered Arch<br/>2 replicas, HPA 2-10]
                        PartService[Participation Service<br/>Layered Arch<br/>2 replicas, HPA 2-8]
                        AnalService[Analytics Service<br/>Layered Arch<br/>2 replicas, HPA 2-10]
                    end
                end
            end

            AppGateway -->|NodePort 30080-30086| UserService
            AppGateway -->|NodePort 30080-30086| EventService
            AppGateway -->|NodePort 30080-30086| AIService
            AppGateway -->|NodePort 30080-30086| ContentService
            AppGateway -->|NodePort 30080-30086| DistService
            AppGateway -->|NodePort 30080-30086| PartService
            AppGateway -->|NodePort 30080-30086| AnalService

            subgraph "Database Subnet (10.0.2.0/24)"
                subgraph "Per-Service Databases"
                    UserDB[User PostgreSQL<br/>Flexible Server<br/>Primary - Zone 1<br/>GP_Standard_D2s_v3]
                    EventDB[Event PostgreSQL<br/>Flexible Server<br/>Primary - Zone 1<br/>GP_Standard_D4s_v3]
                    AIDB[AI PostgreSQL<br/>Flexible Server<br/>Primary - Zone 1<br/>GP_Standard_D2s_v3]
                    ContentDB[Content PostgreSQL<br/>Flexible Server<br/>Primary - Zone 1<br/>GP_Standard_D2s_v3]
                    DistDB[Distribution PostgreSQL<br/>Flexible Server<br/>Primary - Zone 1<br/>GP_Standard_D2s_v3]
                    PartDB[Participation PostgreSQL<br/>Flexible Server<br/>Primary - Zone 1<br/>GP_Standard_D2s_v3]
                    AnalDB[Analytics PostgreSQL<br/>Flexible Server<br/>Primary - Zone 1<br/>GP_Standard_D4s_v3]
                end

                subgraph "Database HA"
                    UserReplica[User DB Replica<br/>Zone 2]
                    EventReplica[Event DB Replica<br/>Zone 2]
                    AnalReplica[Analytics DB Replica<br/>Zone 2]
                    AutoBackup[Automated Backup<br/>Point-in-time Recovery<br/>35 days retention]
                end
            end

            subgraph "Cache Subnet (10.0.3.0/24)"
                RedisPrimary[Azure Redis Premium<br/>P2 - 6GB<br/>Primary - Zone 1<br/>AI결과/이미지/사업자검증 캐시]
                RedisSecondary[Redis Secondary<br/>Zone 2<br/>HA Enabled]
            end
        end

        subgraph "Service Bus Premium"
            ServiceBusPremium[Azure Service Bus<br/>Premium Tier<br/>sb-kt-event-prod]

            subgraph "Message Queues"
                AIQueue[ai-event-generation<br/>Partitioned, 16GB<br/>비동기 AI 처리]
                ContentQueue[content-generation<br/>Partitioned, 16GB<br/>비동기 이미지 생성]
                DistQueue[distribution-jobs<br/>Partitioned, 16GB<br/>다중 채널 배포]
                AnalQueue[analytics-aggregation<br/>Partitioned, 8GB<br/>실시간 분석]
            end
        end

        subgraph "Private Endpoints"
            UserDBEndpoint[User DB<br/>Private Endpoint<br/>10.0.2.10]
            EventDBEndpoint[Event DB<br/>Private Endpoint<br/>10.0.2.11]
            AIDBEndpoint[AI DB<br/>Private Endpoint<br/>10.0.2.12]
            ContentDBEndpoint[Content DB<br/>Private Endpoint<br/>10.0.2.13]
            DistDBEndpoint[Distribution DB<br/>Private Endpoint<br/>10.0.2.14]
            PartDBEndpoint[Participation DB<br/>Private Endpoint<br/>10.0.2.15]
            AnalDBEndpoint[Analytics DB<br/>Private Endpoint<br/>10.0.2.16]
            RedisEndpoint[Redis<br/>Private Endpoint<br/>10.0.3.10]
            ServiceBusEndpoint[Service Bus<br/>Private Endpoint<br/>10.0.4.10]
            KeyVaultEndpoint[Key Vault<br/>Private Endpoint<br/>10.0.6.10]
        end

        subgraph "Security & Management"
            KeyVault[Azure Key Vault<br/>Premium<br/>HSM-backed<br/>시크릿 관리]
            AAD[Azure Active Directory<br/>RBAC Integration]
            Monitor[Azure Monitor<br/>+ Application Insights<br/>Log Analytics]
        end

        %% Database Private Link Connections
        UserService -->|Private Link| UserDBEndpoint
        EventService -->|Private Link| EventDBEndpoint
        AIService -->|Private Link| AIDBEndpoint
        ContentService -->|Private Link| ContentDBEndpoint
        DistService -->|Private Link| DistDBEndpoint
        PartService -->|Private Link| PartDBEndpoint
        AnalService -->|Private Link| AnalDBEndpoint

        UserDBEndpoint --> UserDB
        EventDBEndpoint --> EventDB
        AIDBEndpoint --> AIDB
        ContentDBEndpoint --> ContentDB
        DistDBEndpoint --> DistDB
        PartDBEndpoint --> PartDB
        AnalDBEndpoint --> AnalDB

        %% Cache Private Link Connections - Cache-Aside Pattern
        UserService -->|Private Link<br/>Cache-Aside| RedisEndpoint
        AIService -->|Private Link<br/>Cache-Aside<br/>24h TTL| RedisEndpoint
        ContentService -->|Private Link<br/>Cache-Aside<br/>이미지 캐싱| RedisEndpoint
        AnalService -->|Private Link<br/>Cache-Aside<br/>5분 간격| RedisEndpoint

        RedisEndpoint --> RedisPrimary
        RedisEndpoint --> RedisSecondary

        %% Service Bus Private Link Connections - Async Request-Reply Pattern
        AIService -->|Private Link<br/>Async Request-Reply| ServiceBusEndpoint
        ContentService -->|Private Link<br/>Async Request-Reply| ServiceBusEndpoint
        DistService -->|Private Link<br/>7개 채널 배포| ServiceBusEndpoint
        AnalService -->|Private Link<br/>실시간 분석| ServiceBusEndpoint

        ServiceBusEndpoint --> ServiceBusPremium
        ServiceBusPremium --> AIQueue
        ServiceBusPremium --> ContentQueue
        ServiceBusPremium --> DistQueue
        ServiceBusPremium --> AnalQueue

        %% High Availability Connections
        UserDB -.->|Replication| UserReplica
        EventDB -.->|Replication| EventReplica
        AnalDB -.->|Replication| AnalReplica
        UserDB -.->|Auto Backup| AutoBackup
        EventDB -.->|Auto Backup| AutoBackup
        AIDB -.->|Auto Backup| AutoBackup
        ContentDB -.->|Auto Backup| AutoBackup
        DistDB -.->|Auto Backup| AutoBackup
        PartDB -.->|Auto Backup| AutoBackup
        AnalDB -.->|Auto Backup| AutoBackup
        RedisPrimary -.->|HA Sync| RedisSecondary

        %% Security Connections - Managed Identity
        UserService -.->|Managed Identity| KeyVaultEndpoint
        EventService -.->|Managed Identity| KeyVaultEndpoint
        AIService -.->|Managed Identity| KeyVaultEndpoint
        ContentService -.->|Managed Identity| KeyVaultEndpoint
        DistService -.->|Managed Identity| KeyVaultEndpoint
        PartService -.->|Managed Identity| KeyVaultEndpoint
        AnalService -.->|Managed Identity| KeyVaultEndpoint

        KeyVaultEndpoint --> KeyVault

        UserService -.->|RBAC| AAD
        EventService -.->|RBAC| AAD
        AIService -.->|RBAC| AAD
        ContentService -.->|RBAC| AAD
        DistService -.->|RBAC| AAD
        PartService -.->|RBAC| AAD
        AnalService -.->|RBAC| AAD

        %% Monitoring Connections
        UserService -.->|Telemetry| Monitor
        EventService -.->|Telemetry| Monitor
        AIService -.->|Telemetry| Monitor
        ContentService -.->|Telemetry| Monitor
        DistService -.->|Telemetry| Monitor
        PartService -.->|Telemetry| Monitor
        AnalService -.->|Telemetry| Monitor
    end

    %% External Integrations - Circuit Breaker Pattern
    subgraph "External Services - Circuit Breaker 적용"
        TaxAPI[국세청 API<br/>사업자번호 검증]
        ClaudeAPI[Claude API<br/>트렌드 분석 및 추천]
        SDAPI[Stable Diffusion<br/>SNS 이미지 생성]
        UriAPI[우리동네TV API<br/>영상 송출]
        RingoAPI[링고비즈 API<br/>연결음]
        GenieAPI[지니TV API<br/>광고 등록]
        InstagramAPI[Instagram API<br/>SNS 포스팅]
        NaverAPI[Naver Blog API<br/>블로그 포스팅]
        KakaoAPI[Kakao API<br/>채널 포스팅]
    end

    %% External API Connections with Circuit Breaker
    UserService -->|Circuit Breaker<br/>실패율 5% 임계값| TaxAPI
    AIService -->|Circuit Breaker<br/>10초 타임아웃| ClaudeAPI
    ContentService -->|Circuit Breaker<br/>5초 타임아웃| SDAPI
    DistService -->|Circuit Breaker<br/>독립 채널 처리| UriAPI
    DistService -->|Circuit Breaker<br/>독립 채널 처리| RingoAPI
    DistService -->|Circuit Breaker<br/>독립 채널 처리| GenieAPI
    DistService -->|Circuit Breaker<br/>독립 채널 처리| InstagramAPI
    DistService -->|Circuit Breaker<br/>독립 채널 처리| NaverAPI
    DistService -->|Circuit Breaker<br/>독립 채널 처리| KakaoAPI

    %% DevOps & CI/CD
    subgraph "DevOps Infrastructure"
        GitHubActions[GitHub Actions<br/>Enterprise CI/CD]
        ArgoCD[ArgoCD<br/>GitOps Deployment<br/>HA Mode]
        ContainerRegistry[Azure Container Registry<br/>Premium Tier<br/>Geo-replicated]
    end

    %% DevOps Connections
    GitHubActions -->|Build & Push| ContainerRegistry
    ArgoCD -->|Deploy| UserService
    ArgoCD -->|Deploy| EventService
    ArgoCD -->|Deploy| AIService
    ArgoCD -->|Deploy| ContentService
    ArgoCD -->|Deploy| DistService
    ArgoCD -->|Deploy| PartService
    ArgoCD -->|Deploy| AnalService

    %% Backup & DR
    subgraph "Backup & Disaster Recovery"
        BackupVault[Azure Backup Vault<br/>GRS - 99.999999999%]
        DRSite[DR Site<br/>Secondary Region<br/>Korea Central]
    end

    UserDB -.->|Automated Backup| BackupVault
    EventDB -.->|Automated Backup| BackupVault
    AIDB -.->|Automated Backup| BackupVault
    ContentDB -.->|Automated Backup| BackupVault
    DistDB -.->|Automated Backup| BackupVault
    PartDB -.->|Automated Backup| BackupVault
    AnalDB -.->|Automated Backup| BackupVault
    RedisPrimary -.->|Data Persistence| BackupVault
    ContainerRegistry -.->|Image Backup| BackupVault
    BackupVault -.->|Geo-replication| DRSite

    %% Styling
    classDef azureService fill:#0078d4,stroke:#333,stroke-width:2px,color:#fff
    classDef microservice fill:#28a745,stroke:#333,stroke-width:2px,color:#fff
    classDef database fill:#dc3545,stroke:#333,stroke-width:2px,color:#fff
    classDef cache fill:#ff6b6b,stroke:#333,stroke-width:2px,color:#fff
    classDef security fill:#ffc107,stroke:#333,stroke-width:2px,color:#333
    classDef external fill:#17a2b8,stroke:#333,stroke-width:2px,color:#fff
    classDef devops fill:#6f42c1,stroke:#333,stroke-width:2px,color:#fff
    classDef backup fill:#e83e8c,stroke:#333,stroke-width:2px,color:#fff
    classDef privateEndpoint fill:#fd7e14,stroke:#333,stroke-width:2px,color:#fff
    classDef nodePool fill:#20c997,stroke:#333,stroke-width:2px,color:#fff
    classDef queue fill:#f8b500,stroke:#333,stroke-width:2px,color:#333

    class CDN,AppGateway,ServiceBusPremium,ContainerRegistry,Monitor,AAD azureService
    class UserService,EventService,AIService,ContentService,DistService,PartService,AnalService microservice
    class UserDB,EventDB,AIDB,ContentDB,DistDB,PartDB,AnalDB,UserReplica,EventReplica,AnalReplica,AutoBackup database
    class RedisPrimary,RedisSecondary cache
    class KeyVault,KeyVaultEndpoint security
    class Users,TaxAPI,ClaudeAPI,SDAPI,UriAPI,RingoAPI,GenieAPI,InstagramAPI,NaverAPI,KakaoAPI external
    class GitHubActions,ArgoCD devops
    class BackupVault,DRSite backup
    class UserDBEndpoint,EventDBEndpoint,AIDBEndpoint,ContentDBEndpoint,DistDBEndpoint,PartDBEndpoint,AnalDBEndpoint,RedisEndpoint,ServiceBusEndpoint privateEndpoint
    class SystemNode1,SystemNode2,SystemNode3,AppNode1,AppNode2,AppNode3 nodePool
    class AIQueue,ContentQueue,DistQueue,AnalQueue queue
