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.util.Objects;

/**
 * A TBLimits.
 */
@Entity
@Table(name = "tb_limits")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "smf_tblimits")
public class TBLimits implements Serializable {

    private static final long serialVersionUID = 1L;

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

    @Column(name = "upper_limit")
    private Double upperLimit;

    @Column(name = "lower_limit")
    private Double lowerLimit;

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBGuidelineDetails tbGuidelineDetails;

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBObjectParameter tbObjectParameter;

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBEnvironmentalParameter tbEnvironmentalParameter;

    // 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 getUpperLimit() {
        return upperLimit;
    }

    public TBLimits upperLimit(Double upperLimit) {
        this.upperLimit = upperLimit;
        return this;
    }

    public void setUpperLimit(Double upperLimit) {
        this.upperLimit = upperLimit;
    }

    public Double getLowerLimit() {
        return lowerLimit;
    }

    public TBLimits lowerLimit(Double lowerLimit) {
        this.lowerLimit = lowerLimit;
        return this;
    }

    public void setLowerLimit(Double lowerLimit) {
        this.lowerLimit = lowerLimit;
    }

    public TBGuidelineDetails getTbGuidelineDetails() {
        return tbGuidelineDetails;
    }

    public TBLimits tbGuidelineDetails(TBGuidelineDetails tBGuidelineDetails) {
        this.tbGuidelineDetails = tBGuidelineDetails;
        return this;
    }

    public void setTbGuidelineDetails(TBGuidelineDetails tBGuidelineDetails) {
        this.tbGuidelineDetails = tBGuidelineDetails;
    }

    public TBObjectParameter getTbObjectParameter() {
        return tbObjectParameter;
    }

    public TBLimits tbObjectParameter(TBObjectParameter tBObjectParameter) {
        this.tbObjectParameter = tBObjectParameter;
        return this;
    }

    public void setTbObjectParameter(TBObjectParameter tBObjectParameter) {
        this.tbObjectParameter = tBObjectParameter;
    }

    public TBEnvironmentalParameter getTbEnvironmentalParameter() {
        return tbEnvironmentalParameter;
    }

    public TBLimits tbEnvironmentalParameter(TBEnvironmentalParameter tBEnvironmentalParameter) {
        this.tbEnvironmentalParameter = tBEnvironmentalParameter;
        return this;
    }

    public void setTbEnvironmentalParameter(TBEnvironmentalParameter tBEnvironmentalParameter) {
        this.tbEnvironmentalParameter = tBEnvironmentalParameter;
    }
    // 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;
        }
        TBLimits tBLimits = (TBLimits) o;
        if (tBLimits.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tBLimits.getId());
    }

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

    @Override
    public String toString() {
        return "TBLimits{" +
            "id=" + getId() +
            ", upperLimit=" + getUpperLimit() +
            ", lowerLimit=" + getLowerLimit() +
            "}";
    }
}
