{
  "schemaVersion": "1.0",
  "id": "deletion-progress",
  "title": "Theo dõi yêu cầu xóa",
  "purpose": "Restricted status-capability view after sessions revoked without household data.",
  "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 deletion",
        "componentIds": [
          "screen-header",
          "deletion-progress-0",
          "deletion-progress-1",
          "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": "restricted status only after revoke",
        "backTarget": "account-deletion",
        "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": "deletion-progress-0",
      "type": "DeletionSteps",
      "props": {
        "contentText": "1. Kiểm tra phụ thuộc  Chờ xử lý quyền chủ nhà/guardian.    2. Ghi nhận yêu cầu  Chỉ sau xác minh và chính sách hợp lệ.    3. Xử lý dữ liệu  Tiến độ từ máy chủ, không phải thời hạn tự hứa."
      },
      "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": "Theo dõi yêu cầu xóa · DeletionSteps",
        "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": "deletion-progress-1",
      "type": "Notice",
      "props": {
        "text": "Đây là minh họa tiến trình. Chưa có yêu cầu xóa nào được gửi.",
        "tone": "warn"
      },
      "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": "Theo dõi yêu cầu xóa · Notice",
        "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": "screen-actions",
      "type": "ActionGroup",
      "props": {
        "actions": [
          {
            "id": "deletion-status",
            "label": "Kiểm tra tiến độ mẫu",
            "kind": "mutate",
            "target": null,
            "confirmationRequired": false
          },
          {
            "id": "navigate-1",
            "label": "Xem các bước cần xử 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
          },
          {
            "id": "link-settings",
            "label": "Cài đặt",
            "kind": "navigate",
            "target": "settings",
            "confirmationRequired": false
          }
        ],
        "primaryCount": 1
      },
      "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": "preparing",
      "when": "Server state preparing",
      "visibleUI": "Minimal status, dependency_code",
      "availableActions": [
        "deletion-status",
        "navigate-1",
        "link-account-deletion",
        "link-settings"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    },
    {
      "id": "accepted",
      "when": "Intent durable before revoke",
      "visibleUI": "Status credential in SecureStore",
      "availableActions": [
        "navigate-1",
        "link-account-deletion",
        "link-settings"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    },
    {
      "id": "progress",
      "when": "Purging/complete",
      "visibleUI": "No adult contact or HH DTO",
      "availableActions": [
        "deletion-status",
        "navigate-1",
        "link-account-deletion",
        "link-settings"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    },
    {
      "id": "lost-response",
      "when": "POST response lost",
      "visibleUI": "Recover ID by restricted status route",
      "availableActions": [
        "deletion-status",
        "navigate-1",
        "link-account-deletion",
        "link-settings"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    }
  ],
  "actions": [
    {
      "id": "deletion-status",
      "label": "Kiểm tra tiến độ mẫu",
      "kind": "mutate",
      "targetScreenId": null,
      "permission": "Requester session or restricted status capability",
      "confirmationRequired": false,
      "contractRef": "GET /v1/account/deletion-requests/{id}",
      "localBehavior": "Only validated draft/local domain where supported; remote adapters never report success.",
      "idempotency": "Stable actor/household/command key and canonical body; changed payload is a new confirmed intent."
    },
    {
      "id": "navigate-1",
      "label": "Xem các bước cần xử lý",
      "kind": "navigate",
      "targetScreenId": "leave-household",
      "permission": "restricted status only after revoke",
      "confirmationRequired": false,
      "contractRef": "local navigation",
      "localBehavior": "Only validated draft/local domain where supported; remote adapters never report success.",
      "idempotency": null
    },
    {
      "id": "link-account-deletion",
      "label": "Xem trước khi xóa",
      "kind": "navigate",
      "targetScreenId": "account-deletion",
      "permission": "restricted status only after revoke",
      "confirmationRequired": false,
      "contractRef": "local navigation"
    },
    {
      "id": "link-settings",
      "label": "Cài đặt",
      "kind": "navigate",
      "targetScreenId": "settings",
      "permission": "restricted status only after revoke",
      "confirmationRequired": false,
      "contractRef": "local navigation"
    }
  ],
  "dataBindings": [
    {
      "source": "GET /v1/account/deletion-requests/{id}",
      "shape": {
        "deletion_request_id": "opaque ID",
        "state": "awaiting_transfer|preparing_recovery_intent|accepted|processing|completed|blocked",
        "dependency_code": "string|null",
        "requested_at": "UTC",
        "accepted_at": "UTC|null",
        "completed_at": "UTC|null"
      },
      "sample": {
        "deletion_request_id": "delete-example",
        "state": "awaiting_transfer",
        "dependency_code": "OWNER_REQUIRED",
        "requested_at": "2026-10-14T05:00:00Z",
        "accepted_at": null,
        "completed_at": null
      },
      "sampleOnly": true,
      "actorConstraint": "exact actor allowlist",
      "envelope": "API refs use CommandEnvelope; local review context is not an API property."
    }
  ],
  "copy": {
    "heading": "Theo dõi yêu cầu xóa",
    "primary": "Kiểm tra tiến độ mẫu",
    "empty": null,
    "notices": [
      "Đây là minh họa tiến trình. Chưa có yêu cầu xóa nào được gửi."
    ],
    "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/deletion-progress",
    "nativeRouteStatus": "proposed mapping, verify against implementing native navigator",
    "apiRefs": [
      "GET /v1/account/deletion-requests/{id}",
      "GET /v1/account/deletion-request"
    ],
    "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": "restricted status only after revoke",
    "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."
    }
  }
}
