{
  "schema_version": 1,
  "diagram_type": "architecture",
  "meta": {
    "title": "SSA: toàn cảnh kiến trúc đề xuất",
    "output": "docs/ssa-miniapp/archify/overview.html",
    "quality_profile": "showcase"
  },
  "components": [
    {
      "id": "parent",
      "type": "frontend",
      "label": "Zalo Mini App",
      "sublabel": "Chọn con / xem / gửi yêu cầu",
      "pos": [
        40,
        200
      ],
      "size": [
        196,
        72
      ]
    },
    {
      "id": "proxy",
      "type": "security",
      "label": "VPS Việt Nam",
      "sublabel": "TLS / xác minh đường origin",
      "pos": [
        350,
        200
      ],
      "size": [
        196,
        72
      ]
    },
    {
      "id": "api",
      "type": "backend",
      "label": "API Worker",
      "sublabel": "Session / quyền / nghiệp vụ",
      "pos": [
        670,
        200
      ],
      "size": [
        196,
        72
      ]
    },
    {
      "id": "db",
      "type": "database",
      "label": "D1",
      "sublabel": "Quyền / generation / outbox",
      "pos": [
        990,
        200
      ],
      "size": [
        196,
        72
      ]
    },
    {
      "id": "staff",
      "type": "external",
      "label": "Nhân sự SSA",
      "sublabel": "Identity riêng / theo role",
      "pos": [
        40,
        400
      ],
      "size": [
        196,
        72
      ]
    },
    {
      "id": "admin",
      "type": "frontend",
      "label": "Admin SSA",
      "sublabel": "Duyệt / hỗ trợ / xử lý",
      "pos": [
        350,
        400
      ],
      "size": [
        196,
        72
      ]
    },
    {
      "id": "importer",
      "type": "backend",
      "label": "Import Worker",
      "sublabel": "Validate / stage / publish CAS",
      "pos": [
        990,
        400
      ],
      "size": [
        196,
        72
      ]
    },
    {
      "id": "files",
      "type": "database",
      "label": "R2 private",
      "sublabel": "Raw Excel / PDF / backup",
      "pos": [
        670,
        400
      ],
      "size": [
        196,
        72
      ]
    },
    {
      "id": "misa",
      "type": "external",
      "label": "MISA export",
      "sublabel": "File theo lịch SSA",
      "pos": [
        670,
        600
      ],
      "size": [
        196,
        72
      ]
    },
    {
      "id": "airflow",
      "type": "backend",
      "label": "Airflow Việt Nam",
      "sublabel": "Điều phối / chờ SSA duyệt",
      "pos": [
        990,
        600
      ],
      "size": [
        196,
        72
      ]
    },
    {
      "id": "jobs",
      "type": "messagebus",
      "label": "Jobs / Queue / Cron",
      "sublabel": "Claim outbox / kiểm quyền gửi",
      "pos": [
        990,
        40
      ],
      "size": [
        196,
        72
      ]
    },
    {
      "id": "provider",
      "type": "external",
      "label": "ZBS / email",
      "sublabel": "Chỉ khi kênh được duyệt",
      "pos": [
        670,
        40
      ],
      "size": [
        196,
        72
      ]
    }
  ],
  "connections": [
    {
      "id": "e0",
      "from": "parent",
      "to": "proxy",
      "label": "HTTPS"
    },
    {
      "id": "e1",
      "from": "proxy",
      "to": "api",
      "label": "Proxy identity"
    },
    {
      "id": "e2",
      "from": "api",
      "to": "db",
      "label": "Đọc / ghi"
    },
    {
      "id": "e3",
      "from": "staff",
      "to": "admin",
      "label": "MFA / role"
    },
    {
      "id": "e4",
      "from": "admin",
      "to": "api",
      "label": "Lệnh có quyền"
    },
    {
      "id": "e5",
      "from": "misa",
      "to": "airflow",
      "label": "Manifest file"
    },
    {
      "id": "e6",
      "from": "airflow",
      "to": "importer",
      "label": "API nội bộ"
    },
    {
      "id": "e7",
      "from": "importer",
      "to": "db",
      "label": "Duyệt + CAS"
    },
    {
      "id": "e8",
      "from": "importer",
      "to": "files",
      "label": "File private"
    },
    {
      "id": "e9",
      "from": "api",
      "to": "files",
      "label": "PDF có quyền"
    },
    {
      "id": "e10",
      "from": "db",
      "to": "jobs",
      "label": "Outbox"
    },
    {
      "id": "e11",
      "from": "jobs",
      "to": "provider",
      "label": "Gửi / retry"
    }
  ],
  "cards": [
    {
      "dot": "amber",
      "title": "Điều kiện production",
      "items": [
        "A được chọn về hướng kỹ thuật; G0/G1 chưa đóng.",
        "VPS tại Việt Nam không chứng minh residency Cloudflare."
      ]
    },
    {
      "dot": "emerald",
      "title": "Hai luồng tách biệt",
      "items": [
        "Request phụ huynh đi qua proxy, không qua Airflow.",
        "Airflow không ghi D1; Import Worker giữ rule publish."
      ]
    },
    {
      "dot": "slate",
      "title": "Phạm vi",
      "items": [
        "Kiến trúc nền tảng đề xuất; Mini App có source UI mock, chưa có backend thật.",
        "Checkout/provider, refund và settlement xem các sơ đồ thương mại bổ sung.",
        "Cơ sở: PLAN.md §§4–5 và FEATURES.md §7, bản làm việc 12/11/2026."
      ]
    }
  ]
}
