package de.effigenix.domain.inventory;

import de.effigenix.shared.common.Quantity;

import java.util.Objects;

public class StockBatchAllocation {

    private final AllocationId id;
    private final StockBatchId stockBatchId;
    private final Quantity allocatedQuantity;

    public StockBatchAllocation(AllocationId id, StockBatchId stockBatchId, Quantity allocatedQuantity) {
        this.id = Objects.requireNonNull(id);
        this.stockBatchId = Objects.requireNonNull(stockBatchId);
        this.allocatedQuantity = Objects.requireNonNull(allocatedQuantity);
    }

    public AllocationId id() { return id; }
    public StockBatchId stockBatchId() { return stockBatchId; }
    public Quantity allocatedQuantity() { return allocatedQuantity; }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (!(obj instanceof StockBatchAllocation other)) return false;
        return Objects.equals(id, other.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
