// SeikatsuHogoSystem — 画面固有設定（app-core.js が window.SYSTEM_CONFIG を読む）
window.SYSTEM_CONFIG = {
  domains: [
  { id: "protection-cases", label: "保護事件", endpoint: "/api/protection-cases",
    cols: [{ key: "caseNumber", label: "事件番号" }, { key: "applicantName", label: "申請者氏名" }, { key: "address", label: "住所" }, { key: "status", label: "状態", badge: true }, { key: "createdAt", label: "申請日時" }],
    createFields: [{ name: "applicantName", label: "申請者氏名", required: true, placeholder: "山田 太郎" }, { name: "address", label: "住所", required: true, placeholder: "東京都..." }, { name: "applicationDate", label: "申請日", type: "date" }] },
],
  calc: { title: "最低生活費の試算", endpoint: "/api/seikatsu/minimum-cost", primary: { key: "minimumCost", label: "最低生活費（月額）", format: "yen" }, fields: [ { key: "members", label: "世帯員の年齢（改行区切り）", type: "ages", placeholder: "30\n8\n5" }, { key: "housingCost", label: "家賃（円）", type: "number", default: 0 }, { key: "additions", label: "各種加算（円）", type: "number", default: 0 } ] },
  // 中間サーバ照会（別表: 生活保護決定事務）。世帯人数分の年齢行を仮置き（年齢は窓口で実態に合わせて修正）。所得金額は収入認定の参考表示
  linkage: {
    agency: "seikatsu", procedure: "生活保護決定事務",
    queries: [ { holder: "tax", item: "所得金額" }, { holder: "juki", item: "世帯人数" } ],
    apply(values, setField) {
      const n = Number(values["世帯人数"] || 0);
      if (!n) return false;
      setField("members", Array(n).fill("40").join("\n"));
      return true;
    },
  },
};
