package shop.backend;

/*
TODO
Setter getter tutorial schauen <----Erledigt



 */
public class Product {
    private int prodID;
    private String name;
    private double transportWeight;
    private double netPrice;

    private double mwst;    // <----- Maybe final setzen
    private int stock;

    public Product(int prodID, String name, double transportWeight, double netPrice, double mwst, int stock) {
        this.prodID = prodID;
        this.name = name;
        this.transportWeight = transportWeight;
        this.netPrice = netPrice;
        this.mwst = mwst;
        this.stock = stock;

    }

    //Aus den Vorlesungen
     @Override
    public boolean equals(Object o) {
        if (!(o instanceof Product))
            return false;

        if (!this.name.equals(((Product) o).name) || this.netPrice != ((Product) o).netPrice)
            return false;

        return true;
    }

    //Get ---> Methoden zum abrufen der Vals
    public String getName() {
        return name;
    }

    public int getStock() {
        return stock;
    }

    public int getProdID() {
        return prodID;
    }

    public double getNetPrice() {
        return netPrice;
    }
    //Änderung aus ansatz azs vl
    public double getBruttoPrice() {
        return Math.round(netPrice * (1 + mwst/100));
    }

    public double getMwst() {
        return mwst;
    }

    public double getTransportWeight() {
        return transportWeight;
    }
    //
    @Override
    public String toString() {
        return String.format("[%d] %-25s | %6.2f € Netprice | Stock: %2d", prodID, name, netPrice, stock);
    }

    //Lagerbestand kann sich ändern. Einzige setter Methode
    public void setStock(int neuerLagerbestand) {
        this.stock = neuerLagerbestand;
    }

}



