{
  "schemaVersion": "1.0",
  "id": "submission-review",
  "title": "Bông đã tưới cây",
  "purpose": "Review latest submission ID/version trước approve/reject.",
  "roles": [
    "guardian"
  ],
  "group": "members-children",
  "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 submission",
        "componentIds": [
          "screen-header",
          "submission-review-0",
          "submission-review-1",
          "submission-review-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": "G exact child",
        "backTarget": "approvals",
        "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": "submission-review-0",
      "type": "SubmissionSummary",
      "props": {
        "contentText": "Chờ bạn duyệt  Tưới cây nhỏ  Bông · Phòng khách · 09:20, 14/10 · mẫu"
      },
      "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": "Bông đã tưới cây · SubmissionSummary",
        "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": "submission-review-1",
      "type": "DetailList",
      "props": {
        "items": [
          [
            "Công sức snapshot",
            "1 / 3"
          ],
          [
            "Hướng dẫn",
            "Tưới ít nước ở gốc, lau đĩa lót"
          ],
          [
            "Điểm hiện tại",
            "Chưa ghi nhận cho lần này"
          ]
        ]
      },
      "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": "Bông đã tưới cây · DetailList",
        "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": "submission-review-2",
      "type": "Notice",
      "props": {
        "text": "Chỉ đúng phụ huynh của Bông được duyệt. Nếu đã được xử lý ở máy khác, tải trạng thái mới.",
        "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": "Bông đã tưới cây · Notice",
        "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": "approve",
            "label": "Duyệt bài mẫu của Bông",
            "kind": "mutate",
            "target": null,
            "confirmationRequired": true
          },
          {
            "id": "navigate-1",
            "label": "Nhắn con làm lại",
            "kind": "navigate",
            "target": "submission-redo",
            "confirmationRequired": false
          },
          {
            "id": "link-approvals",
            "label": "Việc chờ bạn duyệt",
            "kind": "navigate",
            "target": "approvals",
            "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": "pending",
      "when": "Latest pending submission/version",
      "visibleUI": "Approve/reject visible",
      "availableActions": [
        "approve",
        "navigate-1",
        "link-approvals",
        "link-settings"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    },
    {
      "id": "already-resolved",
      "when": "409 cycle/version changed",
      "visibleUI": "Canonical result, không điểm trùng",
      "availableActions": [
        "navigate-1",
        "link-approvals",
        "link-settings"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    },
    {
      "id": "offline",
      "when": "Không mạng",
      "visibleUI": "Duyệt online-only",
      "availableActions": [
        "navigate-1",
        "link-approvals",
        "link-settings"
      ],
      "mutationPolicy": "Actor, exact capability and current versions must still pass; this state never grants rights."
    }
  ],
  "actions": [
    {
      "id": "approve",
      "label": "Duyệt bài mẫu của Bông",
      "kind": "mutate",
      "targetScreenId": null,
      "permission": "G exact child",
      "confirmationRequired": true,
      "contractRef": "POST /v1/households/{hid}/occurrences/{oid}/approve",
      "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": "Nhắn con làm lại",
      "kind": "navigate",
      "targetScreenId": "submission-redo",
      "permission": "G exact child",
      "confirmationRequired": false,
      "contractRef": "local navigation",
      "localBehavior": "Only validated draft/local domain where supported; remote adapters never report success.",
      "idempotency": null
    },
    {
      "id": "link-approvals",
      "label": "Việc chờ bạn duyệt",
      "kind": "navigate",
      "targetScreenId": "approvals",
      "permission": "G exact child",
      "confirmationRequired": false,
      "contractRef": "local navigation"
    },
    {
      "id": "link-settings",
      "label": "Cài đặt",
      "kind": "navigate",
      "targetScreenId": "settings",
      "permission": "G exact child",
      "confirmationRequired": false,
      "contractRef": "local navigation"
    }
  ],
  "dataBindings": [
    {
      "source": "POST /v1/households/{hid}/occurrences/{oid}/approve",
      "shape": {
        "expected_version": "integer (GuardianReviewInput)",
        "submission_event_id": "current latest submission event ID",
        "reason": "string required reject only",
        "occurrence": "ChildOccurrenceDto response"
      },
      "sample": {
        "expected_version": 2,
        "submission_event_id": "submission-plants-example",
        "reason": "Lau đĩa lót nhé.",
        "occurrence": {
          "occurrence_id": "occ-blanket",
          "task_id": "blanket",
          "task_title": "Gấp chăn, xếp gối",
          "instructions": "Gấp chăn rồi xếp gối.",
          "room_id": "living",
          "room_name": "Phòng khách",
          "due_local_date": "2026-10-14",
          "due_timezone": "Asia/Ho_Chi_Minh",
          "snoozed_until_local_date": null,
          "effort_snapshot": 1,
          "status": "open",
          "version": 1,
          "latest_submission_event_id": null,
          "can_submit": true
        }
      },
      "sampleOnly": true,
      "actorConstraint": "exact actor allowlist",
      "envelope": "API refs use CommandEnvelope; local review context is not an API property."
    }
  ],
  "copy": {
    "heading": "Bông đã tưới cây",
    "primary": "Duyệt bài mẫu của Bông",
    "empty": null,
    "notices": [
      "Chỉ đúng phụ huynh của Bông được duyệt. Nếu đã được xử lý ở máy khác, tải trạng thái mớ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/submission-review",
    "nativeRouteStatus": "proposed mapping, verify against implementing native navigator",
    "apiRefs": [
      "POST /v1/households/{hid}/occurrences/{oid}/approve",
      "POST /v1/households/{hid}/occurrences/{oid}/reject"
    ],
    "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.",
      "Accepted-day recurrence; occurrence due/effort snapshot bất biến; snooze không đổi anchor; pending không reassign; undo điều chỉnh ledger đúng một lần."
    ],
    "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": "G exact child",
    "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."
    }
  }
}
