package vn.azteam.tpf.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;

import org.springframework.data.elasticsearch.annotations.Document;
import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;

/**
 * A TBSuppliesPriceHistory.
 */
@Entity
@Table(name = "tb_supplies_price_history")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "smf_tbsuppliespricehistory")
public class TBSuppliesPriceHistory implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "price_form")
    private Instant priceForm;

    @Column(name = "price")
    private Double price;

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBSuppliesOrder tbSuppliesOrder;

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBSuppliesInWarehouse tbSuppliesInWarehouse;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Instant getPriceForm() {
        return priceForm;
    }

    public TBSuppliesPriceHistory priceForm(Instant priceForm) {
        this.priceForm = priceForm;
        return this;
    }

    public void setPriceForm(Instant priceForm) {
        this.priceForm = priceForm;
    }

    public Double getPrice() {
        return price;
    }

    public TBSuppliesPriceHistory price(Double price) {
        this.price = price;
        return this;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public TBSuppliesOrder getTbSuppliesOrder() {
        return tbSuppliesOrder;
    }

    public TBSuppliesPriceHistory tbSuppliesOrder(TBSuppliesOrder tBSuppliesOrder) {
        this.tbSuppliesOrder = tBSuppliesOrder;
        return this;
    }

    public void setTbSuppliesOrder(TBSuppliesOrder tBSuppliesOrder) {
        this.tbSuppliesOrder = tBSuppliesOrder;
    }

    public TBSuppliesInWarehouse getTbSuppliesInWarehouse() {
        return tbSuppliesInWarehouse;
    }

    public TBSuppliesPriceHistory tbSuppliesInWarehouse(TBSuppliesInWarehouse tBSuppliesInWarehouse) {
        this.tbSuppliesInWarehouse = tBSuppliesInWarehouse;
        return this;
    }

    public void setTbSuppliesInWarehouse(TBSuppliesInWarehouse tBSuppliesInWarehouse) {
        this.tbSuppliesInWarehouse = tBSuppliesInWarehouse;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TBSuppliesPriceHistory tBSuppliesPriceHistory = (TBSuppliesPriceHistory) o;
        if (tBSuppliesPriceHistory.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tBSuppliesPriceHistory.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "TBSuppliesPriceHistory{" +
            "id=" + getId() +
            ", priceForm='" + getPriceForm() + "'" +
            ", price=" + getPrice() +
            "}";
    }
}
