package org.example.petshopdesktop.models;

import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;

/**
 *  The class for the entity of products (contains all data relating to products)
 */
public class Product {
    private SimpleIntegerProperty prodId;
    private SimpleStringProperty prodName;
    private SimpleDoubleProperty prodPrice;
    private SimpleIntegerProperty categoryId;
    private SimpleStringProperty prodDesc;

    //constructor
    public Product(int prodId, String prodName, double prodPrice, int categoryId, String prodDesc) {
        this.prodId = new SimpleIntegerProperty(prodId);
        this.prodName = new SimpleStringProperty(prodName);
        this.prodPrice = new SimpleDoubleProperty(prodPrice);
        this.categoryId = new SimpleIntegerProperty(categoryId);
        this.prodDesc = new SimpleStringProperty(prodDesc);
    }

    //getter and setters
    public int getProdId() {
        return prodId.get();
    }

    public SimpleIntegerProperty prodIdProperty() {
        return prodId;
    }

    public void setProdId(int prodId) {
        this.prodId.set(prodId);
    }

    public String getProdName() {
        return prodName.get();
    }

    public SimpleStringProperty prodNameProperty() {
        return prodName;
    }

    public void setProdName(String prodName) {
        this.prodName.set(prodName);
    }

    public double getProdPrice() {
        return prodPrice.get();
    }

    public SimpleDoubleProperty prodPriceProperty() {
        return prodPrice;
    }

    public void setProdPrice(double prodPrice) {
        this.prodPrice.set(prodPrice);
    }

    public int getCategoryId() {
        return categoryId.get();
    }

    public SimpleIntegerProperty categoryIdProperty() {
        return categoryId;
    }

    public void setCategoryId(int categoryId) {
        this.categoryId.set(categoryId);
    }

    public String getProdDesc() {
        return prodDesc.get();
    }

    public SimpleStringProperty prodDescProperty() {
        return prodDesc;
    }

    public void setProdDesc(String prodDesc) {
        this.prodDesc.set(prodDesc);
    }

    @Override
    public String toString() {
        return getProdName();
    }
}
