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 TBStockUpdate.
 */
@Entity
@Table(name = "tb_stock_update")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "smf_tbstockupdate")
public class TBStockUpdate implements Serializable {

    private static final long serialVersionUID = 1L;

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

    @Column(name = "update_date")
    private Instant updateDate;

    @Column(name = "action")
    private Integer action;

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

    @Column(name = "description")
    private String description;

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

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

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBActivity tbActivity;

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBBlockDetails tbBlockDetails;

    // 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 getUpdateDate() {
        return updateDate;
    }

    public TBStockUpdate updateDate(Instant updateDate) {
        this.updateDate = updateDate;
        return this;
    }

    public void setUpdateDate(Instant updateDate) {
        this.updateDate = updateDate;
    }

    public Integer getAction() {
        return action;
    }

    public TBStockUpdate action(Integer action) {
        this.action = action;
        return this;
    }

    public void setAction(Integer action) {
        this.action = action;
    }

    public Double getQuantity() {
        return quantity;
    }

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

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

    public String getDescription() {
        return description;
    }

    public TBStockUpdate description(String description) {
        this.description = description;
        return this;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public TBSuppliesOrder getTbSuppliesOrder() {
        return tbSuppliesOrder;
    }

    public TBStockUpdate 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

    public TBSuppliesInWarehouse getTbSuppliesInWarehouse() {
        return tbSuppliesInWarehouse;
    }

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

    public void setTbSuppliesInWarehouse(TBSuppliesInWarehouse tbSuppliesInWarehouse) {
        this.tbSuppliesInWarehouse = tbSuppliesInWarehouse;
    }

    public TBActivity getTbActivity() {
        return tbActivity;
    }

    public TBStockUpdate tbActivity(TBActivity tbActivity) {
        this.tbActivity = tbActivity;
        return this;
    }

    public void setTbActivity(TBActivity tbActivity) {
        this.tbActivity = tbActivity;
    }

    public TBBlockDetails getTbBlockDetails() {
        return tbBlockDetails;
    }

    public TBStockUpdate tbBlockDetails(TBBlockDetails tbBlockDetails) {
        this.tbBlockDetails = tbBlockDetails;
        return this;
    }

    public void setTbBlockDetails(TBBlockDetails tbBlockDetails) {
        this.tbBlockDetails = tbBlockDetails;
    }

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

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

    @Override
    public String toString() {
        return "TBStockUpdate{" +
            "id=" + getId() +
            ", updateDate='" + getUpdateDate() + "'" +
            ", action=" + getAction() +
            ", quantity=" + getQuantity() +
            ", description='" + getDescription() + "'" +
            "}";
    }
}
