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

    private static final long serialVersionUID = 1L;

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

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

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

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

    @Column(name = "jhi_mode")
    private Integer mode;

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

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

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

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

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBEquipment tbEquipment;

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

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBEntity tbEntity;

    @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;

    // 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 getQrCode() {
        return qrCode;
    }

    public TBEquipmentOfCustomer qrCode(String qrCode) {
        this.qrCode = qrCode;
        return this;
    }

    public void setQrCode(String qrCode) {
        this.qrCode = qrCode;
    }

    public String getName() {
        return name;
    }

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

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

    public String getStatus() {
        return status;
    }

    public TBEquipmentOfCustomer status(String status) {
        this.status = status;
        return this;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Integer getMode() {
        return mode;
    }

    public TBEquipmentOfCustomer mode(Integer mode) {
        this.mode = mode;
        return this;
    }

    public void setMode(Integer mode) {
        this.mode = mode;
    }

    public String getSerial() {
        return serial;
    }

    public void setSerial(String serial) {
        this.serial = serial;
    }

    public Instant getCreatedDate() {
        return createdDate;
    }

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

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

    public Instant getModifiedDate() {
        return modifiedDate;
    }

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

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

    public Instant getDeletedDate() {
        return deletedDate;
    }

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

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

    public TBEquipment getTbEquipment() {
        return tbEquipment;
    }

    public TBEquipmentOfCustomer tbEquipment(TBEquipment tBEquipment) {
        this.tbEquipment = tBEquipment;
        return this;
    }

    public void setTbEquipment(TBEquipment tBEquipment) {
        this.tbEquipment = tBEquipment;
    }

    public TBCustomer getTbCustomer() {
        return tbCustomer;
    }

    public TBEquipmentOfCustomer tbCustomer(TBCustomer tBCustomer) {
        this.tbCustomer = tBCustomer;
        return this;
    }

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

    public TBEntity getTbEntity() {
        return tbEntity;
    }

    public TBEquipmentOfCustomer tbEntity(TBEntity tBEntity) {
        this.tbEntity = tBEntity;
        return this;
    }

    public void setTbEntity(TBEntity tBEntity) {
        this.tbEntity = tBEntity;
    }

    public TBDetailUser getCreatedBy() {
        return createdBy;
    }

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

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

    public TBDetailUser getModifiedBy() {
        return modifiedBy;
    }

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

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

    public TBDetailUser getDeletedBy() {
        return deletedBy;
    }

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

    public void setDeletedBy(TBDetailUser tBDetailUser) {
        this.deletedBy = 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;
        }
        TBEquipmentOfCustomer tBEquipmentOfCustomer = (TBEquipmentOfCustomer) o;
        if (tBEquipmentOfCustomer.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tBEquipmentOfCustomer.getId());
    }

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

    @Override
    public String toString() {
        return "TBEquipmentOfCustomer{" +
            "id=" + getId() +
            ", qrCode='" + getQrCode() + "'" +
            ", name='" + getName() + "'" +
            ", status='" + getStatus() + "'" +
            ", mode=" + getMode() +
            ", createdDate='" + getCreatedDate() + "'" +
            ", modifiedDate='" + getModifiedDate() + "'" +
            ", deletedDate='" + getDeletedDate() + "'" +
            "}";
    }
}
