package com.aps.macroplanner.data;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * 工艺路线展开结果 — 包含 {@link Routing#expand} 自动生成的所有数据。
 *
 * <p>调用方将展开结果中的各项数据合并到 {@link TestDataBuilder} 中。</p>
 *
 * <h3>展开内容</h3>
 * <pre>
 *   - stockingPoints: 中间 WIP 库存点 (如 WIP_R001_1, WIP_R001_2)
 *   - productSpMappings: 产品→WIP 库存点映射
 *   - initialInventories: 中间 WIP 初始库存 (均为 0)
 *   - operationInputs: 工序间 BOM 消耗关系
 * </pre>
 *
 * @see Routing
 */
public class RoutingExpansion {

    private final Routing routing;

    /** 自动生成的中间 WIP 库存点 */
    private final List<StockingPoint> stockingPoints = new ArrayList<>();

    /** 产品→WIP 库存点映射 */
    private final List<ProductSpMapping> productSpMappings = new ArrayList<>();

    /** 中间 WIP 初始库存 (均为 0) */
    private final List<InitialInventory> initialInventories = new ArrayList<>();

    /** 工序间 BOM 消耗关系 */
    private final List<OperationInput> operationInputs = new ArrayList<>();

    RoutingExpansion(Routing routing) {
        this.routing = routing;
    }

    void addStockingPoint(StockingPoint sp) {
        stockingPoints.add(sp);
    }

    void addProductSpMapping(ProductSpMapping mapping) {
        productSpMappings.add(mapping);
    }

    void addInitialInventory(InitialInventory inv) {
        initialInventories.add(inv);
    }

    void addOperationInput(OperationInput input) {
        operationInputs.add(input);
    }

    // ==================== Getters ====================

    public Routing getRouting() { return routing; }
    public List<StockingPoint> getStockingPoints() { return Collections.unmodifiableList(stockingPoints); }
    public List<ProductSpMapping> getProductSpMappings() { return Collections.unmodifiableList(productSpMappings); }
    public List<InitialInventory> getInitialInventories() { return Collections.unmodifiableList(initialInventories); }
    public List<OperationInput> getOperationInputs() { return Collections.unmodifiableList(operationInputs); }
}