{
    "display_name": "FC朝日電器受注（099049）",
    "description": "朝日電器フォーキャスト向けフォーキャストExcel取込（1ファイル=1伝票、全件引当しない、A列注番テーブル形式）",
    "processor_class": "App\\Services\\Logic\\User\\CsvImport\\Processors\\FcForecastOrderProcessor",
    "business_key_field": "注番",
    "header_table": "order_headers",
    "detail_table": "order_details",
    "file_type": "xlsx",
    "excel_format": "fc_forecast",
    "fc_pattern": "fc_asahi",
    "has_header": false,
    "headers": [
        "注番", "商品CD", "商品型番", "原価", "数量"
    ],
    "header_fields": {
        "注番": {
            "label": "注番",
            "csv_column": 0,
            "type": "string",
            "required": false,
            "max_length": 200,
            "description": "A列の値（例: '26.8月FC'）。order_headers.order_number にはファイル先頭明細行のA列値、各 order_details.order_number には各行のA列値をコピー（空欄許容）"
        }
    },
    "detail_fields": {
        "商品CD": {
            "label": "商品CD（JANコード）",
            "csv_column": 1,
            "type": "string",
            "required": true,
            "max_length": 13,
            "description": "B列のJANコード。products.jan_code から商品IDを解決（複数該当時はStep3.4で選択）"
        },
        "商品型番": {
            "label": "商品型番",
            "csv_column": 2,
            "type": "string",
            "required": false,
            "description": "C列の商品型番（参照用、Step3.4の商品選択UIに表示）"
        },
        "原価": {
            "label": "原価",
            "csv_column": 3,
            "type": "decimal",
            "required": false,
            "description": "D列の原価。>0 なら unit_price として手単登録、0/空欄/文字列ならOrderAssistで自動取得"
        },
        "数量": {
            "label": "数量",
            "csv_column": 4,
            "type": "integer",
            "required": true,
            "min": 1,
            "description": "E列の数量（ヘッダ文言は月毎に変動: 「数量」/「N月計画数」等）。0または空欄の行は取込対象外（バリデーションエラーにしない）"
        }
    },
    "business_rules": {
        "jan_code_resolution": {
            "rule": "resolve_by_jan_code",
            "description": "商品CD(JAN)から商品IDを解決。is_active=1, stock_output_type=1 で検索",
            "on_not_found": "validation_error",
            "on_multiple": "step3_4_selection"
        },
        "allocation_fixed": {
            "rule": "allocation_type_fixed_to_2",
            "description": "フォーキャスト用途のため、全明細を allocation_type=2（確保しない）固定で登録"
        },
        "single_slip_per_file": {
            "rule": "group_all_rows_into_one_header",
            "description": "1取込=1伝票。全明細を単一の order_headers にまとめて登録（A列注番が行ごとに異なっても1伝票化）"
        },
        "order_number_propagation": {
            "rule": "copy_a_column_per_row",
            "description": "A列の注番を order_headers.order_number にはファイル先頭明細行値、各 order_details.order_number には各行値としてコピー（空欄許容、重複チェックなし）"
        },
        "unit_price_fallback": {
            "rule": "fallback_to_order_assist_when_invalid",
            "description": "D列が 0/空欄/数値変換不可の場合は unit_price を未設定とし、BaseOrderProcessor::setPriceTypeAndUnitPrice() 経由で OrderAssist::getUnitPrice() による特単→ランク単価の自動取得に委ねる"
        },
        "row_filtering": {
            "rule": "skip_qty_zero",
            "description": "数量0/空欄の行はパース時にスキップ。朝日電器レイアウトには集計行は存在しない前提"
        }
    },
    "excel_format_example": {
        "description": "朝日電器テーブル形式構造（kiro/CSVFC/FCインポート(朝日電器レイアウト).xlsx 参照）",
        "layout": {
            "Row 1": "列見出し（無視） [A]日付 [B]JANコード [C]型番 [D]原価 [E]数量(or N月計画数)",
            "Row 2+": "明細データ [A]注番(例: 26.8月FC) [B]商品CD [C]商品型番 [D]原価 [E]数量",
            "末尾": "集計行なし"
        }
    }
}
