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

    private static final long serialVersionUID = 1L;

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

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

    @Column(name = "external_table")
    private String externalTable;

    @Column(name = "object_type")
    private Integer objectType;

    @Column(name = "jhi_condition")
    private String condition;

    @Column(name = "is_guideline_using")
    private Boolean isGuidelineUsing;

    @Column(name = "created_date")
    private Instant createdDate;

    @Column(name = "modified_date")
    private Instant modifiedDate;

    @Column(name = "deleted_date")
    private Instant deletedDate;

    @ManyToOne(fetch=FetchType.LAZY)
    @JsonIgnoreProperties("")
    @JoinColumn(name = "created_by")
    private TBDetailUser createdBy;

    @ManyToOne(fetch=FetchType.LAZY)
    @JsonIgnoreProperties("")
    @JoinColumn(name = "modified_by")
    private TBDetailUser modifiedBy;

    @ManyToOne(fetch=FetchType.LAZY)
    @JsonIgnoreProperties("")
    @JoinColumn(name = "deleted_by")
    private TBDetailUser deletedBy;

    @ManyToOne
    @JsonIgnoreProperties("")
    @JoinColumn(name = "tb_activity_type_id")
    private TBActivityType tbActivityType;

    // 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 getName() {
        return name;
    }

    public TBActivityExtendType name(String name) {
        this.name = name;
        return this;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getExternalTable() {
        return externalTable;
    }

    public TBActivityExtendType externalTable(String externalTable) {
        this.externalTable = externalTable;
        return this;
    }

    public void setExternalTable(String externalTable) {
        this.externalTable = externalTable;
    }

    public Integer getObjectType() {
        return objectType;
    }

    public TBActivityExtendType objectType(Integer objectType) {
        this.objectType = objectType;
        return this;
    }

    public void setObjectType(Integer objectType) {
        this.objectType = objectType;
    }

    public String getCondition() {
        return condition;
    }

    public TBActivityExtendType condition(String condition) {
        this.condition = condition;
        return this;
    }

    public void setCondition(String condition) {
        this.condition = condition;
    }

    public TBActivityType getTbActivityType() {
        return tbActivityType;
    }

    public TBActivityExtendType tbActivityType(TBActivityType tBActivityType) {
        this.tbActivityType = tBActivityType;
        return this;
    }

    public void setTbActivityType(TBActivityType tBActivityType) {
        this.tbActivityType = tBActivityType;
    }

    public Boolean getIsGuidelineUsing() {
        return isGuidelineUsing;
    }

    public TBActivityExtendType isGuidelineUsing(Boolean isGuidelineUsing) {
        this.isGuidelineUsing = isGuidelineUsing;
        return this;
    }
    public void setIsGuidelineUsing(Boolean isGuidelineUsing) {
        this.isGuidelineUsing = isGuidelineUsing;
    }


    public Instant getCreatedDate() {
        return createdDate;
    }

    public TBActivityExtendType createdDate(Instant createdDate) {
        this.createdDate = createdDate;
        return this;
    }

    public void setCreatedDate(Instant createdDate) {
        this.createdDate = createdDate;
    }

    public Instant getModifiedDate() {
        return modifiedDate;
    }

    public TBActivityExtendType modifiedDate(Instant modifiedDate) {
        this.modifiedDate = modifiedDate;
        return this;
    }

    public void setModifiedDate(Instant modifiedDate) {
        this.modifiedDate = modifiedDate;
    }

    public Instant getDeletedDate() {
        return deletedDate;
    }

    public TBActivityExtendType deletedDate(Instant deletedDate) {
        this.deletedDate = deletedDate;
        return this;
    }

    public void setDeletedDate(Instant deletedDate) {
        this.deletedDate = deletedDate;
    }

    public TBDetailUser getDeletedBy() {
        return deletedBy;
    }

    public TBActivityExtendType deletedBy(TBDetailUser tBDetailUser) {
        this.deletedBy = tBDetailUser;
        return this;
    }

    public void setDeletedBy(TBDetailUser tBDetailUser) {
        this.deletedBy = tBDetailUser;
    }

    public TBDetailUser getCreatedBy() {
        return createdBy;
    }

    public TBActivityExtendType createdBy(TBDetailUser tBDetailUser) {
        this.createdBy = tBDetailUser;
        return this;
    }

    public void setCreatedBy(TBDetailUser tBDetailUser) {
        this.createdBy = tBDetailUser;
    }

    public TBDetailUser getModifiedBy() {
        return modifiedBy;
    }

    public TBActivityExtendType modifiedBy(TBDetailUser tBDetailUser) {
        this.modifiedBy = tBDetailUser;
        return this;
    }

    public void setModifiedBy(TBDetailUser tBDetailUser) {
        this.modifiedBy = tBDetailUser;
    }

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

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

    @Override
    public String toString() {
        return "TBActivityExtendType{" +
            "id=" + getId() +
            ", name='" + getName() + "'" +
            ", externalTable='" + getExternalTable() + "'" +
            ", objectType=" + getObjectType() +
            ", condition='" + getCondition() + "'" +
            ", isGuidelineUsing='" + getIsGuidelineUsing() + "'" +
            "}";
    }
}
