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

    private static final long serialVersionUID = 1L;

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

    @Column(name = "jhi_index")
    private String index;

    @Column(name = "times")
    private Integer times;

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

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBActivity tbActivity;

    // 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 getIndex() {
        return index;
    }

    public TBObjectUpdate index(String index) {
        this.index = index;
        return this;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    public Integer getTimes() {
        return times;
    }

    public TBObjectUpdate times(Integer times) {
        this.times = times;
        return this;
    }

    public void setTimes(Integer times) {
        this.times = times;
    }

    public TBObjectParameter getTbObjectParameter() {
        return tbObjectParameter;
    }

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

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

    public TBActivity getTbActivity() {
        return tbActivity;
    }

    public TBObjectUpdate tbActivity(TBActivity tBActivity) {
        this.tbActivity = tBActivity;
        return this;
    }

    public void setTbActivity(TBActivity tBActivity) {
        this.tbActivity = tBActivity;
    }
    // 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;
        }
        TBObjectUpdate tBObjectUpdate = (TBObjectUpdate) o;
        if (tBObjectUpdate.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tBObjectUpdate.getId());
    }

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

    @Override
    public String toString() {
        return "TBObjectUpdate{" +
            "id=" + getId() +
            ", index=" + getIndex() +
            ", times=" + getTimes() +
            "}";
    }
}
