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

    private static final long serialVersionUID = 1L;

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

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

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

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

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

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBFunctionGroup tbFunctionGroup;

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

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

    public String getTypeRequest() {
        return typeRequest;
    }

    public TBFunction typeRequest(String typeRequest) {
        this.typeRequest = typeRequest;
        return this;
    }

    public void setTypeRequest(String typeRequest) {
        this.typeRequest = typeRequest;
    }

    public String getPath() {
        return path;
    }

    public TBFunction path(String path) {
        this.path = path;
        return this;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getMethod() {
        return method;
    }

    public TBFunction method(String method) {
        this.method = method;
        return this;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public TBFunctionGroup getTbFunctionGroup() {
        return tbFunctionGroup;
    }

    public TBFunction tbFunctionGroup(TBFunctionGroup tBFunctionGroup) {
        this.tbFunctionGroup = tBFunctionGroup;
        return this;
    }

    public void setTbFunctionGroup(TBFunctionGroup tBFunctionGroup) {
        this.tbFunctionGroup = tBFunctionGroup;
    }
    // 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;
        }
        TBFunction tBFunction = (TBFunction) o;
        if (tBFunction.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tBFunction.getId());
    }

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

    @Override
    public String toString() {
        return "TBFunction{" +
            "id=" + getId() +
            ", name='" + getName() + "'" +
            ", typeRequest='" + getTypeRequest() + "'" +
            ", path='" + getPath() + "'" +
            ", method='" + getMethod() + "'" +
            "}";
    }
}
