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

    private static final long serialVersionUID = 1L;

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


    @ManyToOne
    @JsonIgnoreProperties("")
    private TBCropType tbCropType;

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBCustomer tbCustomer;

    @ManyToOne
    @JsonIgnoreProperties("")
    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 TBCropType getTbCropType() {
        return tbCropType;
    }

    public TBCustomerHasCropType tbCropType(TBCropType tbCropType) {
        this.tbCropType = tbCropType;
        return this;
    }

    public void setTbCropType(TBCropType tbCropType) {
        this.tbCropType = tbCropType;
    }

    public TBCustomer getTbCustomer() {
        return tbCustomer;
    }

    public TBCustomerHasCropType tbCustomer(TBCustomer tbCustomer) {
        this.tbCustomer = tbCustomer;
        return this;
    }
    public void setTbCustomer(TBCustomer tbCustomer) {
        this.tbCustomer = tbCustomer;
    }

    public TBActivityType getTbActivityType() {
        return tbActivityType;
    }

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

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

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

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

    @Override
    public String toString() {
        return "TBCustomerHasCropType{" +
            "id=" + getId() +
            "tbCustomer=" + getTbCustomer() +
            "tbActivityType=" + getTbActivityType() +
            "tbCropType=" + getTbCropType() +
            "}";
    }
}
