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.util.Objects;

/**
 * A TBSuppliesOrderDetails.
 */
@Entity
@Table(name = "tb_supplies_order_details")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "smf_tbsuppliesorderdetails")
public class TBSuppliesOrderDetails implements Serializable {

    private static final long serialVersionUID = 1L;

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

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

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

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBSupplies tbSupplies;

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

    // 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 Double getQuantity() {
        return quantity;
    }

    public TBSuppliesOrderDetails quantity(Double quantity) {
        this.quantity = quantity;
        return this;
    }

    public void setQuantity(Double quantity) {
        this.quantity = quantity;
    }

    public Long getPrice() {
        return price;
    }

    public TBSuppliesOrderDetails price(Long price) {
        this.price = price;
        return this;
    }

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

    public TBSupplies getTbSupplies() {
        return tbSupplies;
    }

    public TBSuppliesOrderDetails tbSupplies(TBSupplies tBSupplies) {
        this.tbSupplies = tBSupplies;
        return this;
    }

    public void setTbSupplies(TBSupplies tBSupplies) {
        this.tbSupplies = tBSupplies;
    }

    public TBSuppliesOrder getTbSuppliesOrder() {
        return tbSuppliesOrder;
    }

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

    public void setTbSuppliesOrder(TBSuppliesOrder tBSuppliesOrder) {
        this.tbSuppliesOrder = tBSuppliesOrder;
    }
    // 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;
        }
        TBSuppliesOrderDetails tBSuppliesOrderDetails = (TBSuppliesOrderDetails) o;
        if (tBSuppliesOrderDetails.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tBSuppliesOrderDetails.getId());
    }

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

    @Override
    public String toString() {
        return "TBSuppliesOrderDetails{" +
            "id=" + getId() +
            ", quantity=" + getQuantity() +
            ", price=" + getPrice() +
            "}";
    }
}
