{
  "schemaVersion": "1.0",
  "id": "session-revoked",
  "title": "Đăng nhập lại",
  "purpose": "Stop queue/hide scoped data before safe auth route.",
  "roles": [
    "public"
  ],
  "group": "resilience",
  "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 session",
        "componentIds": [
          "screen-header",
          "session-revoked-0",
          "session-revoked-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": "public recovery",
        "backTarget": null,
        "settingsTarget": null
      },
      "tokens": {
        "foreground": "{semantic.light.fg}",
        "darkForeground": "{semantic.dark.fg}"
      },
      "accessibility": {
        "label": "Thanh đầu màn hình",
        "readingOrder": 0,
        "focusOrder": "back then settings"
      }
    },
    {
      "id": "session-revoked-0",
      "type": "EmptyState",
      "props": {
        "title": "Cần mở lại quyền truy cập",
        "description": "Thông tin của bạn đang được ẩn cho tới khi đăng nhập lạ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": "Đăng nhập lại · EmptyState",
        "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": "session-revoked-1",
      "type": "Notice",
      "props": {
        "text": "Đăng nhập lại để tiếp tục. Thiết bị của trẻ cần được ghép lạ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": "Đăng nhập lại · 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": "navigate-0",
            "label": "Đăng nhập người lớn",
            "kind": "navigate",
            "target": "login-email",
            "confirmationRequired": false
          },
          {
            "id": "navigate-1",
            "label": "Ghép lại thiết bị trẻ",
            "kind": "navigate",
            "target": "child-pair-redeem",
            "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": "adult-expired",
      "when": "401 adult session",
      "visibleUI": "Stop queue, adult login",
      "availableActions": [
        "navigate-0",
        "navigate-1"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    },
    {
      "id": "child-revoked",
      "when": "403 device revoked",
      "visibleUI": "Clear child scope, only re-pair",
      "availableActions": [
        "navigate-0",
        "navigate-1"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    },
    {
      "id": "epoch-change",
      "when": "SNAPSHOT_REQUIRED",
      "visibleUI": "Atomic scoped snapshot replacement",
      "availableActions": [
        "navigate-0",
        "navigate-1"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    }
  ],
  "actions": [
    {
      "id": "navigate-0",
      "label": "Đăng nhập người lớn",
      "kind": "navigate",
      "targetScreenId": "login-email",
      "permission": "public recovery",
      "confirmationRequired": false,
      "contractRef": "local navigation",
      "localBehavior": "Only validated draft/local domain where supported; remote adapters never report success.",
      "idempotency": null
    },
    {
      "id": "navigate-1",
      "label": "Ghép lại thiết bị trẻ",
      "kind": "navigate",
      "targetScreenId": "child-pair-redeem",
      "permission": "public recovery",
      "confirmationRequired": false,
      "contractRef": "local navigation",
      "localBehavior": "Only validated draft/local domain where supported; remote adapters never report success.",
      "idempotency": null
    }
  ],
  "dataBindings": [
    {
      "source": "GET /v1/me",
      "shape": {
        "actor_kind": "adult|child|unknown",
        "session_state": "expired|revoked",
        "visibility_epoch": "integer",
        "queue_stopped": "boolean"
      },
      "sample": {
        "actor_kind": "unknown",
        "session_state": "revoked",
        "visibility_epoch": 2,
        "queue_stopped": true
      },
      "sampleOnly": true,
      "actorConstraint": "exact actor allowlist",
      "envelope": "API refs use CommandEnvelope; local review context is not an API property."
    }
  ],
  "copy": {
    "heading": "Đăng nhập lại",
    "primary": "Đăng nhập người lớn",
    "empty": {
      "title": "Cần mở lại quyền truy cập",
      "description": "Thông tin của bạn đang được ẩn cho tới khi đăng nhập lại."
    },
    "notices": [
      "Đăng nhập lại để tiếp tục. Thiết bị của trẻ cần được ghép lạ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/session-revoked",
    "nativeRouteStatus": "proposed mapping, verify against implementing native navigator",
    "copyAuthority": "Use copy and component UI props for interface text; permission, state conditions and implementation notes are not user-facing copy",
    "apiRefs": [
      "GET /v1/me"
    ],
    "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": "public recovery",
    "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."
    }
  }
}
