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

import jakarta.persistence.*;

import java.math.BigDecimal;

@Entity
@Table(name = "sales_units")
public class SalesUnitEntity {

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

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "article_id", nullable = false)
    private ArticleEntity article;

    @Column(name = "unit", nullable = false, length = 30)
    private String unit;

    @Column(name = "price_model", nullable = false, length = 30)
    private String priceModel;

    @Column(name = "price_amount", nullable = false, precision = 19, scale = 2)
    private BigDecimal priceAmount;

    @Column(name = "price_currency", nullable = false, length = 3)
    private String priceCurrency;

    protected SalesUnitEntity() {}

    public SalesUnitEntity(String id, ArticleEntity article, String unit, String priceModel,
                           BigDecimal priceAmount, String priceCurrency) {
        this.id = id;
        this.article = article;
        this.unit = unit;
        this.priceModel = priceModel;
        this.priceAmount = priceAmount;
        this.priceCurrency = priceCurrency;
    }

    public String getId() { return id; }
    public ArticleEntity getArticle() { return article; }
    public String getUnit() { return unit; }
    public String getPriceModel() { return priceModel; }
    public BigDecimal getPriceAmount() { return priceAmount; }
    public String getPriceCurrency() { return priceCurrency; }

    public void setId(String id) { this.id = id; }
    public void setArticle(ArticleEntity article) { this.article = article; }
    public void setUnit(String unit) { this.unit = unit; }
    public void setPriceModel(String priceModel) { this.priceModel = priceModel; }
    public void setPriceAmount(BigDecimal priceAmount) { this.priceAmount = priceAmount; }
    public void setPriceCurrency(String priceCurrency) { this.priceCurrency = priceCurrency; }
}
