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 TBProductStockUpdate.
 */
@Entity
@Table(name = "tb_product_stock_update")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "smf_tbproductstockupdate")
public class TBProductStockUpdate 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;

    @Column(name = "update_by")
    private Long updateBy;

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBProductBlockDetails tbProductBlockDetails;

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

    // 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 TBProductStockUpdate updateDate(Instant updateDate) {
        this.updateDate = updateDate;
        return this;
    }

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

    public Integer getAction() {
        return action;
    }

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

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

    public Double getQuantity() {
        return quantity;
    }

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

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

    public String getDescription() {
        return description;
    }

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

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

    public Long getUpdateBy() {
        return updateBy;
    }

    public TBProductStockUpdate updateBy(Long updateBy) {
        this.updateBy = updateBy;
        return this;
    }

    public void setUpdateBy(Long updateBy) {
        this.updateBy = updateBy;
    }

    public TBProductBlockDetails getTbProductBlockDetails() {
        return tbProductBlockDetails;
    }

    public TBProductStockUpdate tbProductBlockDetails(TBProductBlockDetails tBProductBlockDetails) {
        this.tbProductBlockDetails = tBProductBlockDetails;
        return this;
    }

    public void setTbProductBlockDetails(TBProductBlockDetails tBProductBlockDetails) {
        this.tbProductBlockDetails = tBProductBlockDetails;
    }

    public TBActivity getTbActivity() {
        return tbActivity;
    }

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

    public void setTbActivity(TBActivity tbActivity) {
        this.tbActivity = tbActivity;
    }
    // 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;
        }
        TBProductStockUpdate tBProductStockUpdate = (TBProductStockUpdate) o;
        if (tBProductStockUpdate.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tBProductStockUpdate.getId());
    }

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

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