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

    private static final long serialVersionUID = 1L;

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

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

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

    @Column(name = "mfg_date")
    private Instant mfgDate;

    @Column(name = "exp_date")
    private Instant expDate;

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

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

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

    public String getCode() {
        return code;
    }

    public TBBlockDetails code(String code) {
        this.code = code;
        return this;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Instant getMfgDate() {
        return mfgDate;
    }

    public TBBlockDetails mfgDate(Instant mfgDate) {
        this.mfgDate = mfgDate;
        return this;
    }

    public void setMfgDate(Instant mfgDate) {
        this.mfgDate = mfgDate;
    }

    public Instant getExpDate() {
        return expDate;
    }

    public TBBlockDetails expDate(Instant expDate) {
        this.expDate = expDate;
        return this;
    }

    public void setExpDate(Instant expDate) {
        this.expDate = expDate;
    }

    public TBSuppliesInWarehouse getTbSuppliesInWarehouse() {
        return tbSuppliesInWarehouse;
    }

    public TBBlockDetails 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;
        }
        TBBlockDetails tBBlockDetails = (TBBlockDetails) o;
        if (tBBlockDetails.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tBBlockDetails.getId());
    }

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

    @Override
    public String toString() {
        return "TBBlockDetails{" +
            "id=" + getId() +
            ", quantity=" + getQuantity() +
            ", code='" + getCode() + "'" +
            ", mfgDate='" + getMfgDate() + "'" +
            ", expDate='" + getExpDate() + "'" +
            "}";
    }
}
