package vn.azteam.tpf.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.models.auth.In;
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 TBObjectParameter.
 */
@Entity
@Table(name = "tb_object_parameter")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "smf_tbobjectparameter")
public class TBObjectParameter implements Serializable {

    private static final long serialVersionUID = 1L;

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

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

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

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

    @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 = "activity_type")
    private TBActivityType activityType;

    @ManyToOne
    @JsonIgnoreProperties("")
    @JoinColumn(name = "tb_control_type_id")
    private TBControlType tbControlType;

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

    @Column(name = "is_mandatory")
    private Boolean isMandatory;

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

    @ManyToOne
    @JsonIgnoreProperties("")
    @JoinColumn(name = "tb_activity_extend_type_id")
    private TBActivityExtendType tbActivityExtendType;

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

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

    public String getUnit() {
        return unit;
    }

    public TBObjectParameter unit(String unit) {
        this.unit = unit;
        return this;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getDescription() {
        return description;
    }

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

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

    public Instant getCreatedDate() {
        return createdDate;
    }

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

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

    public Instant getModifiedDate() {
        return modifiedDate;
    }

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

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

    public Instant getDeletedDate() {
        return deletedDate;
    }

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

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

    public TBDetailUser getDeletedBy() {
        return deletedBy;
    }

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

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

    public TBDetailUser getCreatedBy() {
        return createdBy;
    }

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

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

    public TBDetailUser getModifiedBy() {
        return modifiedBy;
    }

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

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

    public TBActivityType getActivityType() {
        return activityType;
    }

    public TBObjectParameter activityType(TBActivityType tBActivityType) {
        this.activityType = tBActivityType;
        return this;
    }

    public void setActivityType(TBActivityType tBActivityType) {
        this.activityType = tBActivityType;
    }

    public TBActivityExtendType getTbActivityExtendType() {
        return tbActivityExtendType;
    }

    public TBObjectParameter tbActivityExtendType(TBActivityExtendType tbActivityExtendType) {
        this.tbActivityExtendType = tbActivityExtendType;
        return this;
    }

    public void setTbActivityExtendType(TBActivityExtendType tbActivityExtendType) {
        this.tbActivityExtendType = tbActivityExtendType;
    }

    public Boolean getIsGuidelineUsing() {
        return isGuidelineUsing;
    }

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

    public Boolean getIsMandatory() {
        return isMandatory;
    }

    public TBObjectParameter isMandatory(Boolean isMandatory) {
        this.isMandatory = isMandatory;
        return this;
    }

    public void setIsMandatory(Boolean isMandatory) {
        this.isMandatory = isMandatory;
    }

    public String getGroupName() {
        return groupName;
    }

    public TBObjectParameter groupName(String groupName) {
        this.groupName = groupName;
        return this;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public TBControlType getTbControlType() {
        return tbControlType;
    }

    public TBObjectParameter tbControlType(TBControlType tbControlType) {
        this.tbControlType = tbControlType;
        return this;
    }

    public void setTbControlType(TBControlType tbControlType) {
        this.tbControlType = tbControlType;
    }

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

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

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