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

    private static final long serialVersionUID = 1L;

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

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

    @Column(name = "order_date")
    private Instant orderDate;

    @Column(name = "receive_date")
    private Instant receiveDate;

    @Column(name = "total_price")
    private Long totalPrice;

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

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

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

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

    @ManyToOne
    @JsonIgnoreProperties("")
    private TBVendor tbVendor;

    @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 getStatus() {
        return status;
    }

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

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

    public Instant getOrderDate() {
        return orderDate;
    }

    public TBSuppliesOrder orderDate(Instant orderDate) {
        this.orderDate = orderDate;
        return this;
    }

    public void setOrderDate(Instant orderDate) {
        this.orderDate = orderDate;
    }

    public Instant getReceiveDate() {
        return receiveDate;
    }

    public TBSuppliesOrder receiveDate(Instant receiveDate) {
        this.receiveDate = receiveDate;
        return this;
    }

    public void setReceiveDate(Instant receiveDate) {
        this.receiveDate = receiveDate;
    }

    public Long getTotalPrice() {
        return totalPrice;
    }

    public TBSuppliesOrder totalPrice(Long totalPrice) {
        this.totalPrice = totalPrice;
        return this;
    }

    public void setTotalPrice(Long totalPrice) {
        this.totalPrice = totalPrice;
    }

    public String getDescription() {
        return description;
    }

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

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

    public Instant getCreatedDate() {
        return createdDate;
    }

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

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

    public Instant getModifiedDate() {
        return modifiedDate;
    }

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

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

    public Instant getDeletedDate() {
        return deletedDate;
    }

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

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

    public TBVendor getTbVendor() {
        return tbVendor;
    }

    public TBSuppliesOrder tbVendor(TBVendor tBVendor) {
        this.tbVendor = tBVendor;
        return this;
    }

    public void setTbVendor(TBVendor tBVendor) {
        this.tbVendor = tBVendor;
    }

    public TBDetailUser getCreatedBy() {
        return createdBy;
    }

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

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

    public TBDetailUser getModifiedBy() {
        return modifiedBy;
    }

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

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

    public TBDetailUser getDeletedBy() {
        return deletedBy;
    }

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

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

    @Override
    public String toString() {
        return "TBSuppliesOrder{" +
            "id=" + getId() +
            ", status='" + getStatus() + "'" +
            ", orderDate='" + getOrderDate() + "'" +
            ", receiveDate='" + getReceiveDate() + "'" +
            ", totalPrice=" + getTotalPrice() +
            ", description='" + getDescription() + "'" +
            ", createdDate='" + getCreatedDate() + "'" +
            ", modifiedDate='" + getModifiedDate() + "'" +
            ", deletedDate='" + getDeletedDate() + "'" +
            "}";
    }
}
