package org.example.petshopdesktop.models;

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

/**
 * The class for the entity of supplier (contains all data relating to suppliers)
 */
public class Supplier {
    SimpleIntegerProperty supId;
    SimpleStringProperty supCompany;
    SimpleStringProperty supContactFirstName;
    SimpleStringProperty supContactLastName;
    SimpleStringProperty supEmail;
    SimpleStringProperty supPhone;

    //constructor
    public Supplier(int supId, String supCompany, String supContactFirstName, String supContactLastName, String supEmail, String supPhone) {
        this.supId = new SimpleIntegerProperty(supId);
        this.supCompany = new SimpleStringProperty(supCompany);
        this.supContactFirstName = new SimpleStringProperty(supContactFirstName);
        this.supContactLastName = new SimpleStringProperty(supContactLastName);
        this.supEmail = new SimpleStringProperty(supEmail);
        this.supPhone = new SimpleStringProperty(supPhone);
    }

    //getter and setter
    public int getSupId() {
        return supId.get();
    }

    public SimpleIntegerProperty supIdProperty() {
        return supId;
    }

    public void setSupId(int supId) {
        this.supId.set(supId);
    }

    public String getSupCompany() {
        return supCompany.get();
    }

    public SimpleStringProperty supCompanyProperty() {
        return supCompany;
    }

    public void setSupCompany(String supCompany) {
        this.supCompany.set(supCompany);
    }

    public String getSupContactFirstName() {
        return supContactFirstName.get();
    }

    public SimpleStringProperty supContactFirstNameProperty() {
        return supContactFirstName;
    }

    public void setSupContactFirstName(String supContactFirstName) {
        this.supContactFirstName.set(supContactFirstName);
    }

    public String getSupContactLastName() {
        return supContactLastName.get();
    }

    public SimpleStringProperty supContactLastNameProperty() {
        return supContactLastName;
    }

    public void setSupContactLastName(String supContactLastName) {
        this.supContactLastName.set(supContactLastName);
    }

    public String getSupEmail() {
        return supEmail.get();
    }

    public SimpleStringProperty supEmailProperty() {
        return supEmail;
    }

    public void setSupEmail(String supEmail) {
        this.supEmail.set(supEmail);
    }

    public String getSupPhone() {
        return supPhone.get();
    }

    public SimpleStringProperty supPhoneProperty() {
        return supPhone;
    }

    public void setSupPhone(String supPhone) {
        this.supPhone.set(supPhone);
    }

    //custom methods

    /**
     * Get the full name of supplier contact to display in a single cell
     * @return full name of supplier contact
     */
    public String getSupFullName() {
        return getSupContactFirstName() + " " + getSupContactLastName();
    }

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