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

    private static final long serialVersionUID = 1L;

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

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

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

    @Column(name = "is_can_delete")
    private Boolean isCanDelete;

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

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

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

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

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

    /*
     false: before harvest
     true: after harvest
     */
    @Column(name = "is_after_harvest")
    private Boolean isAfterHarvest;

    @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("")
    private TBCustomer customer;

    @Column(name = "parent_id")
    private Long parentId;

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

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

    public String getDescription() {
        return description;
    }

    public TBActivityType description(String description) {
        this.description = description;
        return this;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Boolean getIsCanDelete() {
        return isCanDelete;
    }

    public TBActivityType isCanDelete(Boolean isCanDelete) {
        this.isCanDelete = isCanDelete;
        return this;
    }

    public void setIsCanDelete(Boolean isCanDelete) {
        this.isCanDelete = isCanDelete;
    }

    public String getUrlLogo() {
        return urlLogo;
    }

    public TBActivityType urlLogo(String urlLogo) {
        this.urlLogo = urlLogo;
        return this;
    }

    public void setUrlLogo(String urlLogo) {
        this.urlLogo = urlLogo;
    }

    public Instant getCreatedDate() {
        return createdDate;
    }

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

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

    public Instant getModifiedDate() {
        return modifiedDate;
    }

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

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

    public Instant getDeletedDate() {
        return deletedDate;
    }

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

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

    public TBDetailUser getDeletedBy() {
        return deletedBy;
    }

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

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

    public TBDetailUser getCreatedBy() {
        return createdBy;
    }

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

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

    public TBDetailUser getModifiedBy() {
        return modifiedBy;
    }

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

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

    public TBCustomer getCustomer() {
        return customer;
    }

    public TBActivityType customer(TBCustomer tBCustomer) {
        this.customer = tBCustomer;
        return this;
    }

    public void setCustomer(TBCustomer tBCustomer) {
        this.customer = tBCustomer;
    }


    public Boolean getIsGuidelineUsing() {
        return isGuidelineUsing;
    }

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

    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TBActivityType tBActivityType = (TBActivityType) o;
        if (tBActivityType.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tBActivityType.getId());
    }

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

    @Override
    public String toString() {
        return "TBActivityType{" +
            "id=" + getId() +
            ", name='" + getName() + "'" +
            ", description='" + getDescription() + "'" +
            ", createdDate='" + getCreatedDate() + "'" +
            ", modifiedDate='" + getModifiedDate() + "'" +
            ", deletedDate='" + getDeletedDate() + "'" +
            "}";
    }
}
