package de.effigenix.infrastructure.inventory.persistence.entity;

import jakarta.persistence.*;

import java.math.BigDecimal;

@Entity
@Table(name = "stock_batch_allocations")
public class StockBatchAllocationEntity {

    @Id
    @Column(name = "id", nullable = false, length = 36)
    private String id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "reservation_id", nullable = false)
    private ReservationEntity reservation;

    @Column(name = "stock_batch_id", nullable = false, length = 36)
    private String stockBatchId;

    @Column(name = "allocated_quantity_amount", nullable = false, precision = 19, scale = 6)
    private BigDecimal allocatedQuantityAmount;

    @Column(name = "allocated_quantity_unit", nullable = false, length = 20)
    private String allocatedQuantityUnit;

    protected StockBatchAllocationEntity() {}

    public StockBatchAllocationEntity(String id, ReservationEntity reservation, String stockBatchId,
                                      BigDecimal allocatedQuantityAmount, String allocatedQuantityUnit) {
        this.id = id;
        this.reservation = reservation;
        this.stockBatchId = stockBatchId;
        this.allocatedQuantityAmount = allocatedQuantityAmount;
        this.allocatedQuantityUnit = allocatedQuantityUnit;
    }

    public String getId() { return id; }
    public void setId(String id) { this.id = id; }
    public ReservationEntity getReservation() { return reservation; }
    public void setReservation(ReservationEntity reservation) { this.reservation = reservation; }
    public String getStockBatchId() { return stockBatchId; }
    public void setStockBatchId(String stockBatchId) { this.stockBatchId = stockBatchId; }
    public BigDecimal getAllocatedQuantityAmount() { return allocatedQuantityAmount; }
    public void setAllocatedQuantityAmount(BigDecimal allocatedQuantityAmount) { this.allocatedQuantityAmount = allocatedQuantityAmount; }
    public String getAllocatedQuantityUnit() { return allocatedQuantityUnit; }
    public void setAllocatedQuantityUnit(String allocatedQuantityUnit) { this.allocatedQuantityUnit = allocatedQuantityUnit; }
}
