import os
os.makedirs('.codewiki/dd/FUW00927SFBean', exist_ok=True)

parts = []

# ===================== SECTION 1 =====================
parts.append("""# Business Logic - FUW00927SFBean.storeModelData() [1127 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | eo.web.webview.FUW00927SF.FUW00927SFBean |
| Layer | Webview / Front-End Bean (Web Presentation Layer) |
| Module | FUW00927SF (Package: eo.web.webview.FUW00927SF) |

## 1. Role

### FUW00927SFBean.storeModelData()

This method is the central data binding router for the K-Opticom FTTH (Fiber-to-the-Home) new subscription order screen (FUW00927SF - "Input Content Confirmation (Sales/Delivery)"). It receives a key/subkey/value triplet and dispatches the incoming data to the correct field setter, list item, or common-info handler based on the semantic meaning of the key.

The method handles four categories of data types: (1) Common information fields (key starts with "//"), which are delegated to the superclass `storeCommonInfoData` - these represent shared screen-level metadata; (2) Single-value String fields (e.g., Function Code, Screen Mode, Monthly Fees, Initial Fees, Contract Type, Customer Info, Fax Request, Display Flags), where data is routed to a `setXxx_value` or `setXxx_state` setter; (3) Single-value Boolean fields (e.g., Contract Service Area Display Flag), where `in_value` is cast to `Boolean` for the value setter and to `String` for the state setter; (4) Repeating list fields (e.g., Item Code, Value, Monthly Fee Items, Smart Link items, NH items), where an index is parsed from the key path, bounds-checked against the backing list, and the data is delegated to the individual list item's own `storeModelData` method - implementing recursive hierarchical data binding.

The design pattern implemented is a routing/dispatch pattern combined with a delegation pattern: the method acts as a central dispatcher that examines the key prefix, extracts nested indices from slash-delimited paths, and delegates to either instance setters or child bean objects. This is a shared utility called by the screen controller to populate model data into this bean's fields.

The method also supports slash-delimited hierarchical key paths (e.g., "getsu_ryokin_kmk/0") to support repeatable/variable-count fields - a common pattern in the K-Opticom web framework for representing line-item data.""")

# ===================== SECTION 2 =====================
parts.append("""
## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["storeModelData params"])
    START --> CHECK_KEY_NULL{key is null?}
    CHECK_KEY_NULL -->|Yes| RETURN_EARLY(["Return immediately"])
    CHECK_KEY_NULL -->|No| CHECK_SUBKEY_NULL{subkey is null?}
    CHECK_SUBKEY_NULL -->|Yes| SET_SUBKEY_EMPTY[subkey set to empty String]
    SET_SUBKEY_EMPTY --> CHECK_SEPARATOR{key starts with //?}
    CHECK_SUBKEY_NULL -->|No| CHECK_SEPARATOR
    CHECK_SEPARATOR -->|Yes| DELEGATE_COMMON[super.storeCommonInfoData]
    CHECK_SEPARATOR -->|No| EXTRACT_KEY_ELEMENT[Extract keyElement before first /]
    DELEGATE_COMMON --> END_RETURN(["Return - Next"])
    EXTRACT_KEY_ELEMENT --> CHECK_FIRST_BRANCH{Match keyElement?}
    CHECK_FIRST_BRANCH -->|"機能コード"| FNC_SET[setFnc_mode_value or setFnc_mode_state]
    FNC_SET --> END_RETURN
    CHECK_FIRST_BRANCH -->|"画面モード"| SCREEN_SET[setScreen_mode_value or setScreen_mode_state]
    SCREEN_SET --> END_RETURN
    CHECK_FIRST_BRANCH -->|"項目コード"| LIST_INDEX[Parse index, bounds check, list.get]
    LIST_INDEX --> LIST_CALL[(listItem.storeModelData)]
    LIST_CALL --> END_RETURN
    CHECK_FIRST_BRANCH -->|"値"| VALUE_LIST[Parse index, bounds check, list.get]
    VALUE_LIST --> VALUE_CALL[(listItem.storeModelData)]
    VALUE_CALL --> END_RETURN
    CHECK_FIRST_BRANCH -->|"月額料金項目"| KMK_LIST[Parse index, bounds check, list.get]
    KMK_LIST --> KMK_CALL[(listItem.storeModelData)]
    KMK_CALL --> END_RETURN
    CHECK_FIRST_BRANCH -->|"月額料金"| GETSU_LIST[Parse index, bounds check, list.get]
    GETSU_LIST --> GETSU_CALL[(listItem.storeModelData)]
    GETSU_CALL --> END_RETURN
    CHECK_FIRST_BRANCH -->|"初期費用項目"| SHOKI_KMK[Parse index, bounds check, list.get]
    SHOKI_KMK --> SHOKI_KMK_CALL[(listItem.storeModelData)]
    SHOKI_KMK_CALL --> END_RETURN
    CHECK_FIRST_BRANCH -->|"初期費用"| SHOKI_LIST[Parse index, bounds check, list.get]
    SHOKI_LIST --> SHOKI_CALL[(listItem.storeModelData)]
    SHOKI_CALL --> END_RETURN
    CHECK_FIRST_BRANCH -->|"月額料金計"| KEI_LIST[Parse index, bounds check, list.get]
    KEI_LIST --> KEI_CALL[(listItem.storeModelData)]
    KEI_CALL --> END_RETURN
    CHECK_FIRST_BRANCH -->|"other simple"| SIMPLE_FIELD[setXxx_value or setXxx_state]
    SIMPLE_FIELD --> END_RETURN
    CHECK_FIRST_BRANCH -->|"other list"| OTHER_LIST[Parse index, bounds check, list.get]
    OTHER_LIST --> OTHER_CALL[(listItem.storeModelData)]
    OTHER_CALL --> END_RETURN
    CHECK_FIRST_BRANCH -->|none match| NO_MATCH([Fall through - no action])
    NO_MATCH --> END_RETURN
```

### Processing Flow Detail

1. **Null Guard (L3427)**: If key is null, return immediately.
2. **Subkey Normalization (L3432)**: If subkey is null, set it to an empty String.
3. **Common Info Check (L3438)**: Check if key starts with "//" (共通情報ビューン). If yes, delegate entirely to super.storeCommonInfoData(key, in_value, isSetAsString).
4. **Key Element Extraction (L3444-3447)**: Extract the first segment of the key before the first "/" character. If no "/" exists, the entire key is the element.
5. **Branch Routing (L3450 onwards)**: Match keyElement against all supported field categories.
6. **Index Parsing for List Fields**: For each list-based field type, extract index from key path, parse as Integer, bounds-check, and delegate to list item's storeModelData.
7. **No-match (L4547-4549)**: If no branch matches, the method falls through silently.

### Supported Field Categories

The method covers approximately 55+ distinct keyElement branches across these categories:

| Category | keyElement (Japanese) | Backend List/Setters | Data Type |
|----------|----------------------|---------------------|-----------|
| Function Code | 機能コード | setFnc_mode_value / setFnc_mode_state | String |
| Screen Mode | 画面モード | setScreen_mode_value / setScreen_mode_state | String |
| Item Code (list) | 項目コード | koumoku_code_list | X33VDataTypeStringBean |
| Value (list) | 値 | koumoku_value_list | X33VDataTypeStringBean |
| Monthly Fee Items (list) | 月額料金項目 | getsu_ryokin_kmk_list | X33VDataTypeStringBean |
| Monthly Fee (list) | 月額料金 | getsu_ryokin_list | X33VDataTypeStringBean |
| Initial Fee Items (list) | 初期費用項目 | shoki_hiyo_kmk_list | X33VDataTypeStringBean |
| Initial Fee (list) | 初期費用 | shoki_hiyo_list | X33VDataTypeStringBean |
| Monthly Fee Total | 月額料金計 | setGetsu_ryokin_kei_value / setGetsu_ryokin_kei_state | String |
| Monthly Fee Total (tax excl) | 月額料金計（税抜） | setGetsu_ryokin_kei_zei_value / setGetsu_ryokin_kei_zei_state | String |
| Initial Fee Total | 初期費用計 | setShoki_hiyo_kei_value / setShoki_hiyo_kei_state | String |
| Initial Fee Total (tax excl) | 初期費用計（税抜） | setShoki_hiyo_kei_zei_value / setShoki_hiyo_kei_zei_state | String |
| Mobile Monthly Fee Total | モバイル月額料金計 | setMobile_month_value / setMobile_month_state | String |
| Mobile Initial Fee Total | モバイル初期費用計 | setMobile_init_value / setMobile_init_state | String |
| Monthly Fee Statement | 月額料金文言 | setGetsu_ryokin_mongon_value / setGetsu_ryokin_mongon_state | String |
| Initial Fee Statement | 初期費用文言 | setShoki_hiyo_mongon_value / setShoki_hiyo_mongon_state | String |
| Mobile Monthly Fee Statement | モバイル月額料金文言 | setMobile_month_mongon_value / setMobile_month_mongon_state | String |
| Mobile Initial Fee Statement | モバイル初期費用文言 | setMobile_init_mongon_value / setMobile_init_mongon_state | String |
| Total with Tax | 月額料金合計 | setGtgk_prc_gokei_value / setGtgk_prc_gokei_state | String |
| Total with Tax (tax excl) | 月額料金合計（税抜） | setGtgk_prc_gokei_zei_value / setGtgk_prc_gokei_zei_state | String |
| Initial Fee Total (grand) | 初期費用合計 | setShkh_gokei_value / setShkh_gokei_state | String |
| Initial Fee Total (grand, tax excl) | 初期費用合計（税抜） | setShkh_gokei_zei_value / setShkh_gokei_zei_state | String |
| Total Statement | 月額料金合計文言 | setGtgk_prc_gokei_mongon_value / setGtgk_prc_gokei_mongon_state | String |
| Initial Fee Total Statement | 初期費用合計文言 | setShkh_gokei_mongon_value / setShkh_gokei_mongon_state | String |
| Contract Type | 契約種別 | setKei_sbt_value / setKei_sbt_state | String |
| Customer Info (Individual) - Gender | ご契約者情報（個人）・性別 | setSex_value / setSex_state | String |
| ID Proof Document | ご本人様確認書類 | setHnin_cfm_aticle_value / setHnin_cfm_aticle_state | String |
| Installation Location - Form | ご利用箇所設置位置・形態 | setSetplace_form_value / setSetplace_form_state | String |
| Installation Location - Floor | ご利用箇所設置位置・階数 | setSetplace_flr_value / setSetplace_flr_state | String |
| Installation Location - Address | ご利用箇所設置位置・住所番号 | setSetplace_bnchi_value / setSetplace_bnchi_state | String |
| Installation Location - Active Network | ご利用箇所設置位置・使用中のネットワーク | setUse_net_ksn_value / setUse_net_ksn_state | String |
| Installation Location - Equipment Change | ご利用箇所設置位置・使用中の機器の設置場所変更予定 | setKiki_place_chg_value / setKiki_place_chg_state | String |
| Installation Location - Same-Day Work | ご利用箇所設置位置・宅内調査と工事の同日実施 | setTkc_koji_same_value / setTkc_koji_same_state | String |
| Contact Preference | 連絡先選択 | setRrks_choice_value / setRrks_choice_state | String |
| FAX Connection Request | FAX連絡ご希望 | setFax_kibo_value / setFax_kibo_state | String |
| Same Place Warning Flag | 同一利用場所警告表示制御フラグ | setDsp_same_use_place_kkoku_flg_value / setDsp_same_use_place_kkoku_flg_state | String |
| Postal Code Display Flag | 郵便番号表示制御フラグ | setDsp_pcd_flg_value / setDsp_pcd_flg_state | String |
| Close Button Display Flag | 閉じるボタン表示制御フラグ | setDsp_close_btn_flg_value / setDsp_close_btn_flg_state | String |
| Register and Next Button Flag | 登録して次へボタン表示フラグ | setDsp_add_btn_flg_value / setDsp_add_btn_flg_state | String |
| Next Button Display Flag | 次へボタン表示フラグ | setDsp_next_btn_flg_value / setDsp_next_btn_flg_state | String |
| Call Charge Limit Notification | 通話料指定額到達通知指定金額 | setTwryo_stiam_ttu_tchi_stiam_value / setTwryo_stiam_ttu_tchi_stiam_state | String |
| Contract Service Area Display Flag | 契約中サービスエリア表示フラグ | setKei_svc_area_dsp_flg_value (Boolean) / setKei_svc_area_dsp_flg_state | Boolean/String |
| CX Project Start Flag | CX案件開始フラグ | setCx_start_flg_value / setCx_start_flg_state | String |
| Home Survey Inst. Pref. Display Flag | 宅内調査のアポ架電希望表示フラグ | setTakcho_apo_kaden_kibo_um_disp_flg_value / setTakcho_apo_kaden_kibo_um_disp_flg_state | String |
| Home Survey Inst. Preference | 宅内調査のアポ架電希望 | setTakcho_apo_kaden_kibo_um_screen_value / _enabled / _state | String/Boolean |
| Monthly Fee Items (Smart Link) (list) | 月額料金項目（スマートリンク） | getsu_ryokin_kmk_sml_list | X33VDataTypeStringBean |
| Monthly Fee (Smart Link) (list) | 月額料金（スマートリンク） | getsu_ryokin_sml_list | X33VDataTypeStringBean |
| Initial Fee Items (Smart Link) (list) | 初期費用項目（スマートリンク） | shoki_hiyo_kmk_sml_list | X33VDataTypeStringBean |
| Initial Fee (Smart Link) (list) | 初期費用（スマートリンク） | shoki_hiyo_sml_list | X33VDataTypeStringBean |
| Discount Valid Period (list) | 月額料金割引文言適用期間 | gtgk_wrib_mngn_tk_kikan_list | X33VDataTypeStringBean |
| Discount Name (list) | 月額料金割引文言割引名 | gtgk_wrib_mngn_wrib_nm_list | X33VDataTypeStringBean |
| Discount Amount (list) | 月額料金割引文言割引額 | gtgk_wrib_mngn_wrib_amnt_list | X33VDataTypeStringBean |
| Discount Remarks (list) | 月額料金割引文言備考 | gtgk_wrib_mngn_biko_list | X33VDataTypeStringBean |
| Monthly Fee Display Items (list) | 月額料金表示項目 | getsu_ryokin_kei_title_list | X33VDataTypeStringBean |
| Monthly Fee Items (NH) (list) | 月額料金項目（ＮＨ） | getsu_ryokin_kmk_gh_list | X33VDataTypeStringBean |
| Monthly Fee (NH) (list) | 月額料金（ＮＨ） | getsu_ryokin_gh_list | X33VDataTypeStringBean |
| Initial Fee Items (NH) (list) | 初期費用項目（ＮＨ） | shoki_hiyo_kmk_gh_list | X33VDataTypeStringBean |
| Initial Fee (NH) (list) | 初期費用（ＮＨ） | shoki_hiyo_gh_list | X33VDataTypeStringBean |""")

with open('.codewiki/dd/FUW00927SFBean/storeModelData.md', 'w', encoding='utf-8') as f:
    f.write('
'.join(parts[:2]) + '
')
print("Parts 1-2 written")
