{
  "schemaVersion": "1.0",
  "id": "privacy",
  "title": "Dữ liệu của bạn",
  "purpose": "Privacy policy gate and accessible safety controls without paywall.",
  "roles": [
    "adult"
  ],
  "group": "settings-privacy",
  "variantOf": null,
  "layout": {
    "canvas": {
      "width": 390,
      "height": 844
    },
    "responsive": {
      "minimumWidth": 360,
      "maximumWidth": 430,
      "scroll": "vertical",
      "safeAreaBottom": true,
      "fontScale": "native dynamic type; reflow without clipping",
      "keyboard": "composer sticky within resized viewport; dialog scrolls; no fixed keyboard overlay"
    },
    "regions": [
      {
        "id": "header",
        "order": 0,
        "type": "safe-area/header",
        "height": "intrinsic"
      },
      {
        "id": "content",
        "order": 1,
        "type": "purpose-specific policy",
        "componentIds": [
          "screen-header",
          "privacy-0",
          "privacy-1",
          "privacy-2",
          "screen-actions"
        ]
      },
      {
        "id": "actions",
        "order": 2,
        "type": "one primary + secondary controls"
      },
      {
        "id": "navigation",
        "order": 3,
        "type": "none"
      }
    ]
  },
  "components": [
    {
      "id": "screen-header",
      "type": "Header",
      "props": {
        "homeLabel": "Nhà Lá",
        "scopeGate": "U",
        "backTarget": "settings",
        "settingsTarget": "settings"
      },
      "tokens": {
        "foreground": "{semantic.light.fg}",
        "darkForeground": "{semantic.dark.fg}"
      },
      "accessibility": {
        "label": "Thanh đầu màn hình",
        "readingOrder": 0,
        "focusOrder": "back then settings"
      }
    },
    {
      "id": "privacy-0",
      "type": "Notice",
      "props": {
        "text": "Chính sách dữ liệu phải được chủ sản phẩm duyệt trước phát hành. Bản mẫu không tự đưa ra điều khoản pháp lý.",
        "tone": ""
      },
      "tokens": {
        "background": "{semantic.light.surface}",
        "foreground": "{semantic.light.fg}",
        "darkBackground": "{semantic.dark.surface}",
        "darkForeground": "{semantic.dark.fg}",
        "bodySize": "{primitive.type.body}",
        "touchTarget": "{primitive.space.48}"
      },
      "accessibility": {
        "label": "Dữ liệu của bạn · Notice",
        "readingOrder": 1,
        "colorOnly": false,
        "fontScaling": true,
        "minimumTouchTarget": 48,
        "instructions": "Đọc theo thứ tự; công bố nhãn trạng thái và lỗi, không chỉ màu."
      }
    },
    {
      "id": "privacy-1",
      "type": "SettingsGroup",
      "props": {
        "items": [
          {
            "label": "Xuất dữ liệu",
            "description": "Chỉ dữ liệu bạn có quyền truy cập",
            "target": "data-export"
          },
          {
            "label": "Rời Nhà Lá",
            "description": "Xem các phụ thuộc cần xử lý",
            "target": "leave-household"
          },
          {
            "label": "Xóa tài khoản",
            "description": "Xác minh lại và xem tác động",
            "target": "account-deletion"
          }
        ]
      },
      "tokens": {
        "background": "{semantic.light.surface}",
        "foreground": "{semantic.light.fg}",
        "darkBackground": "{semantic.dark.surface}",
        "darkForeground": "{semantic.dark.fg}",
        "bodySize": "{primitive.type.body}",
        "touchTarget": "{primitive.space.48}"
      },
      "accessibility": {
        "label": "Dữ liệu của bạn · SettingsGroup",
        "readingOrder": 2,
        "colorOnly": false,
        "fontScaling": true,
        "minimumTouchTarget": 48,
        "instructions": "Đọc theo thứ tự; công bố nhãn trạng thái và lỗi, không chỉ màu."
      }
    },
    {
      "id": "privacy-2",
      "type": "DetailList",
      "props": {
        "items": [
          [
            "Trẻ",
            "Biệt danh/avatar, không email hay ngày sinh"
          ],
          [
            "AI mẫu",
            "Không gửi nội dung sang dịch vụ ngoài"
          ]
        ]
      },
      "tokens": {
        "background": "{semantic.light.surface}",
        "foreground": "{semantic.light.fg}",
        "darkBackground": "{semantic.dark.surface}",
        "darkForeground": "{semantic.dark.fg}",
        "bodySize": "{primitive.type.body}",
        "touchTarget": "{primitive.space.48}"
      },
      "accessibility": {
        "label": "Dữ liệu của bạn · DetailList",
        "readingOrder": 3,
        "colorOnly": false,
        "fontScaling": true,
        "minimumTouchTarget": 48,
        "instructions": "Đọc theo thứ tự; công bố nhãn trạng thái và lỗi, không chỉ màu."
      }
    },
    {
      "id": "screen-actions",
      "type": "ActionGroup",
      "props": {
        "actions": [
          {
            "id": "navigate-0",
            "label": "Trợ giúp về dữ liệu",
            "kind": "navigate",
            "target": "help-about",
            "confirmationRequired": false
          },
          {
            "id": "link-settings",
            "label": "Cài đặt",
            "kind": "navigate",
            "target": "settings",
            "confirmationRequired": false
          },
          {
            "id": "link-data-export",
            "label": "Xuất dữ liệu của tôi",
            "kind": "navigate",
            "target": "data-export",
            "confirmationRequired": false
          },
          {
            "id": "link-leave-household",
            "label": "Rời Nhà Lá",
            "kind": "navigate",
            "target": "leave-household",
            "confirmationRequired": false
          },
          {
            "id": "link-account-deletion",
            "label": "Xem trước khi xóa",
            "kind": "navigate",
            "target": "account-deletion",
            "confirmationRequired": false
          }
        ],
        "primaryCount": 0
      },
      "tokens": {
        "lightBackground": "{component.light.button.background}",
        "lightForeground": "{component.light.button.foreground}",
        "darkBackground": "{component.dark.button.background}",
        "darkForeground": "{component.dark.button.foreground}",
        "height": "{primitive.space.48}"
      },
      "accessibility": {
        "label": "Hành động của màn hình",
        "keyboard": true,
        "focusVisible": true,
        "disabledOnlyLowContrast": true
      }
    }
  ],
  "fields": [],
  "states": [
    {
      "id": "policy-ready",
      "when": "Published version/policy URL",
      "visibleUI": "Show accurate legal link",
      "availableActions": [
        "navigate-0",
        "link-settings",
        "link-data-export",
        "link-leave-household",
        "link-account-deletion"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    },
    {
      "id": "policy-missing",
      "when": "No policy configured",
      "visibleUI": "Deletion/export policy-dependent operations fail closed",
      "availableActions": [
        "navigate-0",
        "link-settings",
        "link-data-export",
        "link-leave-household",
        "link-account-deletion"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    },
    {
      "id": "child-scope",
      "when": "Child actor",
      "visibleUI": "No adult account destructive links",
      "availableActions": [
        "navigate-0",
        "link-settings",
        "link-data-export",
        "link-leave-household",
        "link-account-deletion"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    }
  ],
  "actions": [
    {
      "id": "navigate-0",
      "label": "Trợ giúp về dữ liệu",
      "kind": "navigate",
      "targetScreenId": "help-about",
      "permission": "U",
      "confirmationRequired": false,
      "contractRef": "local navigation",
      "localBehavior": "Only validated draft/local domain where supported; remote adapters never report success.",
      "idempotency": null
    },
    {
      "id": "link-settings",
      "label": "Cài đặt",
      "kind": "navigate",
      "targetScreenId": "settings",
      "permission": "U",
      "confirmationRequired": false,
      "contractRef": "local navigation"
    },
    {
      "id": "link-data-export",
      "label": "Xuất dữ liệu của tôi",
      "kind": "navigate",
      "targetScreenId": "data-export",
      "permission": "U",
      "confirmationRequired": false,
      "contractRef": "local navigation"
    },
    {
      "id": "link-leave-household",
      "label": "Rời Nhà Lá",
      "kind": "navigate",
      "targetScreenId": "leave-household",
      "permission": "U",
      "confirmationRequired": false,
      "contractRef": "local navigation"
    },
    {
      "id": "link-account-deletion",
      "label": "Xem trước khi xóa",
      "kind": "navigate",
      "targetScreenId": "account-deletion",
      "permission": "U",
      "confirmationRequired": false,
      "contractRef": "local navigation"
    }
  ],
  "dataBindings": [
    {
      "source": "GET /v1/account/data-policy",
      "shape": {
        "version": "string",
        "url": "approved policy URL|null",
        "deletion_enabled": "boolean",
        "guardian_child_export_allowed": "boolean"
      },
      "sample": {
        "version": "not-configured",
        "url": null,
        "deletion_enabled": false,
        "guardian_child_export_allowed": false
      },
      "sampleOnly": true,
      "actorConstraint": "exact actor allowlist",
      "envelope": "API refs use CommandEnvelope; local review context is not an API property."
    }
  ],
  "copy": {
    "heading": "Dữ liệu của bạn",
    "primary": null,
    "empty": null,
    "notices": [
      "Chính sách dữ liệu phải được chủ sản phẩm duyệt trước phát hành. Bản mẫu không tự đưa ra điều khoản pháp lý."
    ],
    "locale": "vi",
    "demoLabel": "Bản thiết kế · dữ liệu mẫu · không kết nối dịch vụ"
  },
  "implementation": {
    "nativeRoute": "/design/privacy",
    "nativeRouteStatus": "proposed mapping, verify against implementing native navigator",
    "apiRefs": [
      "GET /v1/account/data-policy"
    ],
    "newContractRefs": [],
    "notes": [
      "Tất cả ví dụ là dữ liệu thiết kế, không bằng chứng native/API/store đã chạy.",
      "Native route dưới đây là đề xuất mapping cho agent, không tuyên bố route source đã tồn tại.",
      "Mọi mutation dùng envelope {data,version,household_revision,replayed}, stable Idempotency-Key và expected_version khi sửa."
    ],
    "integrationStatus": "design complete; local static/draft interactions; native/API adapters pending",
    "sourceAuthority": [
      "docs/product-brief.md",
      "plans/261013-1409-sweepy-vietnam-mobile/mobile-flows.md",
      "plans/261013-1409-sweepy-vietnam-mobile/api-contracts.md",
      "packages/domain/src/contracts/phase2.ts",
      "packages/domain/src/index.ts",
      "packages/domain/src/contracts/phase3.ts",
      "packages/domain/src/contracts/billing.ts",
      "apps/mobile/src/lib/api.ts"
    ],
    "capability": "U",
    "errors": {
      "401": "Stop queue; adult login or child re-pair without parent account.",
      "403": "Do not retry lost capability. FEATURE_REQUIRED never grants Pro.",
      "409": "Fetch canonical scoped state; review/reconfirm new intent, do not rewrite old replay payload.",
      "422": "Field error with retained draft.",
      "429": "Respect Retry-After.",
      "503": "Backoff only retryable commands with original key."
    }
  }
}
