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

    private static final long serialVersionUID = 1L;

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

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

    @Column(name = "date_occurred")
    private Instant dateOccurred;

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

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBCommand tbCommand;

    @ManyToOne(fetch=FetchType.LAZY)
    @JsonIgnoreProperties("")
    @JoinColumn(name = "user_id")
    private TBDetailUser tbDetailUser;

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBEquipmentOfCustomer tbEquipmentOfCustomer;

    // 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 getEvent() {
        return event;
    }

    public TBEquipmentHistory event(String event) {
        this.event = event;
        return this;
    }

    public void setEvent(String event) {
        this.event = event;
    }

    public Instant getDateOccurred() {
        return dateOccurred;
    }

    public TBEquipmentHistory dateOccurred(Instant dateOccurred) {
        this.dateOccurred = dateOccurred;
        return this;
    }

    public void setDateOccurred(Instant dateOccurred) {
        this.dateOccurred = dateOccurred;
    }

    public Integer getStatus() {
        return status;
    }

    public TBEquipmentHistory status(Integer status) {
        this.status = status;
        return this;
    }

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

    public TBCommand getTbCommand() {
        return tbCommand;
    }

    public TBEquipmentHistory tbCommand(TBCommand tBCommand) {
        this.tbCommand = tBCommand;
        return this;
    }

    public void setTbCommand(TBCommand tBCommand) {
        this.tbCommand = tBCommand;
    }

    public TBDetailUser gettbDetailUser() {
        return tbDetailUser;
    }

    public TBEquipmentHistory tbDetailUser(TBDetailUser tbDetailUser) {
        this.tbDetailUser = tbDetailUser;
        return this;
    }

    public void settbDetailUser(TBDetailUser tbDetailUser) {
        this.tbDetailUser = tbDetailUser;
    }

    public TBEquipmentOfCustomer getTbEquipmentOfCustomer() {
        return tbEquipmentOfCustomer;
    }

    public TBEquipmentHistory tbEquipmentOfCustomer(TBEquipmentOfCustomer tBEquipmentOfCustomer) {
        this.tbEquipmentOfCustomer = tBEquipmentOfCustomer;
        return this;
    }

    public void setTbEquipmentOfCustomer(TBEquipmentOfCustomer tBEquipmentOfCustomer) {
        this.tbEquipmentOfCustomer = tBEquipmentOfCustomer;
    }
    // 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;
        }
        TBEquipmentHistory tBEquipmentHistory = (TBEquipmentHistory) o;
        if (tBEquipmentHistory.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tBEquipmentHistory.getId());
    }

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

    @Override
    public String toString() {
        return "TBEquipmentHistory{" +
            "id=" + getId() +
            ", event='" + getEvent() + "'" +
            ", dateOccurred='" + getDateOccurred() + "'" +
            ", status='" + getStatus() + "'" +
            "}";
    }
}
