package com.aps.macroplanner.data;

/**
 * 销售需求 (SalesDemand) — 对应 Quintiq 中的 SalesDemand
 * 表示某个产品在某个库存点、某个周期的销售需求
 */
public class SalesDemand {
    private final Product product;
    private final StockingPoint stockingPoint;
    private final Period period;
    private final double quantity;       // 需求总量
    private final double priority;       // 需求优先级

    public SalesDemand(Product product, StockingPoint stockingPoint, Period period,
                       double quantity, double priority) {
        this.product = product;
        this.stockingPoint = stockingPoint;
        this.period = period;
        this.quantity = quantity;
        this.priority = priority;
    }

    public Product getProduct() { return product; }
    public StockingPoint getStockingPoint() { return stockingPoint; }
    public Period getPeriod() { return period; }
    public double getQuantity() { return quantity; }
    public double getPriority() { return priority; }

    public String getKey() {
        return product.getId() + "_" + stockingPoint.getId() + "_" + period.getIndex();
    }

    @Override
    public String toString() {
        return "SD[" + product + ", " + stockingPoint + ", " + period + "] qty=" + quantity;
    }
}