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

    private static final long serialVersionUID = 1L;

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

    @Column(name = "age_day_start")
    private Integer ageDayStart;

    @Column(name = "age_day_end")
    private Integer ageDayEnd;

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBGuideline tbGuideline;

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBGuidelinePeriod tbGuidelinePeriod;

    // 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 Integer getAgeDayStart() {
        return ageDayStart;
    }

    public TBGuidelineDetails ageDayStart(Integer ageDayStart) {
        this.ageDayStart = ageDayStart;
        return this;
    }

    public void setAgeDayStart(Integer ageDayStart) {
        this.ageDayStart = ageDayStart;
    }

    public Integer getAgeDayEnd() {
        return ageDayEnd;
    }

    public TBGuidelineDetails ageDayEnd(Integer ageDayEnd) {
        this.ageDayEnd = ageDayEnd;
        return this;
    }

    public void setAgeDayEnd(Integer ageDayEnd) {
        this.ageDayEnd = ageDayEnd;
    }

    public TBGuideline getTbGuideline() {
        return tbGuideline;
    }

    public TBGuidelineDetails tbGuideline(TBGuideline tBGuideline) {
        this.tbGuideline = tBGuideline;
        return this;
    }

    public void setTbGuideline(TBGuideline tBGuideline) {
        this.tbGuideline = tBGuideline;
    }

    public TBGuidelinePeriod getTbGuidelinePeriod() {
        return tbGuidelinePeriod;
    }

    public TBGuidelineDetails tbGuidelinePeriod(TBGuidelinePeriod tBGuidelinePeriod) {
        this.tbGuidelinePeriod = tBGuidelinePeriod;
        return this;
    }

    public void setTbGuidelinePeriod(TBGuidelinePeriod tBGuidelinePeriod) {
        this.tbGuidelinePeriod = tBGuidelinePeriod;
    }
    // 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;
        }
        TBGuidelineDetails tBGuidelineDetails = (TBGuidelineDetails) o;
        if (tBGuidelineDetails.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tBGuidelineDetails.getId());
    }

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

    @Override
    public String toString() {
        return "TBGuidelineDetails{" +
            "id=" + getId() +
            ", ageDayStart=" + getAgeDayStart() +
            ", ageDayEnd=" + getAgeDayEnd() +
            "}";
    }
}
