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

    private static final long serialVersionUID = 1L;

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

    @Column(name = "start_time")
    private Instant startTime;

    @Column(name = "duration_in_mins")
    private Integer durationInMins;

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

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

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

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

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

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

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

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBMaintenanceSchedule tbMaintenanceSchedule;

    @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 Instant getStartTime() {
        return startTime;
    }

    public TBMaintenanceDetails startTime(Instant startTime) {
        this.startTime = startTime;
        return this;
    }

    public void setStartTime(Instant startTime) {
        this.startTime = startTime;
    }

    public Integer getDurationInMins() {
        return durationInMins;
    }

    public TBMaintenanceDetails durationInMins(Integer durationInMins) {
        this.durationInMins = durationInMins;
        return this;
    }

    public void setDurationInMins(Integer durationInMins) {
        this.durationInMins = durationInMins;
    }

    public String getAction() {
        return action;
    }

    public TBMaintenanceDetails action(String action) {
        this.action = action;
        return this;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getDescription() {
        return description;
    }

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

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

    public Integer getStatus() {
        return status;
    }

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

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

    public Instant getCreatedDate() {
        return createdDate;
    }

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

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

    public Instant getModifiedDate() {
        return modifiedDate;
    }

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

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

    public Instant getDeletedDate() {
        return deletedDate;
    }

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

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

    public TBEquipmentOfCustomer getTbEquipmentOfCustomer() {
        return tbEquipmentOfCustomer;
    }

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

    public void setTbEquipmentOfCustomer(TBEquipmentOfCustomer tBEquipmentOfCustomer) {
        this.tbEquipmentOfCustomer = tBEquipmentOfCustomer;
    }

    public TBMaintenanceSchedule getTbMaintenanceSchedule() {
        return tbMaintenanceSchedule;
    }

    public TBMaintenanceDetails tbMaintenanceSchedule(TBMaintenanceSchedule tBMaintenanceSchedule) {
        this.tbMaintenanceSchedule = tBMaintenanceSchedule;
        return this;
    }

    public void setTbMaintenanceSchedule(TBMaintenanceSchedule tBMaintenanceSchedule) {
        this.tbMaintenanceSchedule = tBMaintenanceSchedule;
    }

    public TBDetailUser getCreatedBy() {
        return createdBy;
    }

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

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

    public TBDetailUser getModifiedBy() {
        return modifiedBy;
    }

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

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

    public TBDetailUser getDeletedBy() {
        return deletedBy;
    }

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

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

    @Override
    public String toString() {
        return "TBMaintenanceDetails{" +
            "id=" + getId() +
            ", startTime='" + getStartTime() + "'" +
            ", durationInMins=" + getDurationInMins() +
            ", action='" + getAction() + "'" +
            ", description='" + getDescription() + "'" +
            ", status=" + getStatus() +
            ", createdDate='" + getCreatedDate() + "'" +
            ", modifiedDate='" + getModifiedDate() + "'" +
            ", deletedDate='" + getDeletedDate() + "'" +
            "}";
    }
}
