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

    private static final long serialVersionUID = 1L;

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

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

    @Column(name = "product_level_1")
    private Double productLevel1;

    @Column(name = "product_level_2")
    private Double productLevel2;

    @Column(name = "product_level_3")
    private Double productLevel3;

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

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

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBCrop tbCrop;

    // 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 TBProductBlockDetailsReport code(String code) {
        this.code = code;
        return this;
    }

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

    public Double getProductLevel1() {
        return productLevel1;
    }

    public TBProductBlockDetailsReport productLevel1(Double productLevel1) {
        this.productLevel1 = productLevel1;
        return this;
    }

    public void setProductLevel1(Double productLevel1) {
        this.productLevel1 = productLevel1;
    }

    public Double getProductLevel2() {
        return productLevel2;
    }

    public TBProductBlockDetailsReport productLevel2(Double productLevel2) {
        this.productLevel2 = productLevel2;
        return this;
    }

    public void setProductLevel2(Double productLevel2) {
        this.productLevel2 = productLevel2;
    }

    public Double getProductLevel3() {
        return productLevel3;
    }

    public TBProductBlockDetailsReport productLevel3(Double productLevel3) {
        this.productLevel3 = productLevel3;
        return this;
    }

    public void setProductLevel3(Double productLevel3) {
        this.productLevel3 = productLevel3;
    }

    public Instant getCreateDate() {
        return createDate;
    }

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

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

    public TBProductBlockDetails getTbProductBlockDetails() {
        return tbProductBlockDetails;
    }

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

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

    public TBCrop getTbCrop() {
        return tbCrop;
    }

    public TBProductBlockDetailsReport tbCrop(TBCrop tBCrop) {
        this.tbCrop = tBCrop;
        return this;
    }

    public void setTbCrop(TBCrop tBCrop) {
        this.tbCrop = tBCrop;
    }
    // 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;
        }
        TBProductBlockDetailsReport tBProductBlockDetailsReport = (TBProductBlockDetailsReport) o;
        if (tBProductBlockDetailsReport.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tBProductBlockDetailsReport.getId());
    }

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

    @Override
    public String toString() {
        return "TBProductBlockDetailsReport{" +
            "id=" + getId() +
            ", code='" + getCode() + "'" +
            ", productLevel1=" + getProductLevel1() +
            ", productLevel2=" + getProductLevel2() +
            ", productLevel3=" + getProductLevel3() +
            ", createDate='" + getCreateDate() + "'" +
            "}";
    }
}
