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

    private static final long serialVersionUID = 1L;

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

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

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

    @Column(name = "create_date")
    private Instant createDate;

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

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBSuppliesType tbSuppliesType;

    @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 String getCode() {
        return code;
    }

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

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

    public Double getQuantity() {
        return quantity;
    }

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

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

    public Instant getCreateDate() {
        return createDate;
    }

    public TBBlockDetailsReport createDate(Instant createDate) {
        this.createDate = createDate;
        return this;
    }

    public void setCreateDate(Instant createDate) {
        this.createDate = createDate;
    }

    public TBBlockDetails getTbBlockDetails() {
        return tbBlockDetails;
    }

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

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

    public TBSuppliesType getTbSuppliesType() {
        return tbSuppliesType;
    }

    public TBBlockDetailsReport tbSuppliesType(TBSuppliesType tBSuppliesType) {
        this.tbSuppliesType = tBSuppliesType;
        return this;
    }

    public void setTbSuppliesType(TBSuppliesType tBSuppliesType) {
        this.tbSuppliesType = tBSuppliesType;
    }

    public TBSuppliesInWarehouse getTbSuppliesInWarehouse() {
        return tbSuppliesInWarehouse;
    }

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

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

    @Override
    public String toString() {
        return "TBBlockDetailsReport{" +
            "id=" + getId() +
            ", code='" + getCode() + "'" +
            ", quantity=" + getQuantity() +
            ", createDate='" + getCreateDate() + "'" +
            "}";
    }
}
