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

    private static final long serialVersionUID = 1L;

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

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

    @Column(name = "is_repeat")
    private Integer isRepeat;

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

    @Column(name = "is_repeat_on_sunday")
    private Integer isRepeatOnSunday;

    @Column(name = "is_repeat_on_monday")
    private Integer isRepeatOnMonday;

    @Column(name = "is_repeat_on_tuesday")
    private Integer isRepeatOnTuesday;

    @Column(name = "is_repeat_on_wednesday")
    private Integer isRepeatOnWednesday;

    @Column(name = "is_repeat_on_thursday")
    private Integer isRepeatOnThursday;

    @Column(name = "is_repeat_on_friday")
    private Integer isRepeatOnFriday;

    @Column(name = "is_repeat_on_saturday")
    private Integer isRepeatOnSaturday;

    @Column(name = "day_of_month")
    private Integer dayOfMonth;

    @Column(name = "ends_on")
    private Instant endsOn;

    @Column(name = "ends_after_x_occurrences")
    private Integer endsAfterXOccurrences;

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

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

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

    @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 getDescription() {
        return description;
    }

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

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

    public Integer getIsRepeat() {
        return isRepeat;
    }

    public TBMaintenanceSchedule isRepeat(Integer isRepeat) {
        this.isRepeat = isRepeat;
        return this;
    }

    public void setIsRepeat(Integer isRepeat) {
        this.isRepeat = isRepeat;
    }

    public String getRepeatEvery() {
        return repeatEvery;
    }

    public TBMaintenanceSchedule repeatEvery(String repeatEvery) {
        this.repeatEvery = repeatEvery;
        return this;
    }

    public void setRepeatEvery(String repeatEvery) {
        this.repeatEvery = repeatEvery;
    }

    public Integer getIsRepeatOnSunday() {
        return isRepeatOnSunday;
    }

    public TBMaintenanceSchedule isRepeatOnSunday(Integer isRepeatOnSunday) {
        this.isRepeatOnSunday = isRepeatOnSunday;
        return this;
    }

    public void setIsRepeatOnSunday(Integer isRepeatOnSunday) {
        this.isRepeatOnSunday = isRepeatOnSunday;
    }

    public Integer getIsRepeatOnMonday() {
        return isRepeatOnMonday;
    }

    public TBMaintenanceSchedule isRepeatOnMonday(Integer isRepeatOnMonday) {
        this.isRepeatOnMonday = isRepeatOnMonday;
        return this;
    }

    public void setIsRepeatOnMonday(Integer isRepeatOnMonday) {
        this.isRepeatOnMonday = isRepeatOnMonday;
    }

    public Integer getIsRepeatOnTuesday() {
        return isRepeatOnTuesday;
    }

    public TBMaintenanceSchedule isRepeatOnTuesday(Integer isRepeatOnTuesday) {
        this.isRepeatOnTuesday = isRepeatOnTuesday;
        return this;
    }

    public void setIsRepeatOnTuesday(Integer isRepeatOnTuesday) {
        this.isRepeatOnTuesday = isRepeatOnTuesday;
    }

    public Integer getIsRepeatOnWednesday() {
        return isRepeatOnWednesday;
    }

    public TBMaintenanceSchedule isRepeatOnWednesday(Integer isRepeatOnWednesday) {
        this.isRepeatOnWednesday = isRepeatOnWednesday;
        return this;
    }

    public void setIsRepeatOnWednesday(Integer isRepeatOnWednesday) {
        this.isRepeatOnWednesday = isRepeatOnWednesday;
    }

    public Integer getIsRepeatOnThursday() {
        return isRepeatOnThursday;
    }

    public TBMaintenanceSchedule isRepeatOnThursday(Integer isRepeatOnThursday) {
        this.isRepeatOnThursday = isRepeatOnThursday;
        return this;
    }

    public void setIsRepeatOnThursday(Integer isRepeatOnThursday) {
        this.isRepeatOnThursday = isRepeatOnThursday;
    }

    public Integer getIsRepeatOnFriday() {
        return isRepeatOnFriday;
    }

    public TBMaintenanceSchedule isRepeatOnFriday(Integer isRepeatOnFriday) {
        this.isRepeatOnFriday = isRepeatOnFriday;
        return this;
    }

    public void setIsRepeatOnFriday(Integer isRepeatOnFriday) {
        this.isRepeatOnFriday = isRepeatOnFriday;
    }

    public Integer getIsRepeatOnSaturday() {
        return isRepeatOnSaturday;
    }

    public TBMaintenanceSchedule isRepeatOnSaturday(Integer isRepeatOnSaturday) {
        this.isRepeatOnSaturday = isRepeatOnSaturday;
        return this;
    }

    public void setIsRepeatOnSaturday(Integer isRepeatOnSaturday) {
        this.isRepeatOnSaturday = isRepeatOnSaturday;
    }

    public Integer getDayOfMonth() {
        return dayOfMonth;
    }

    public TBMaintenanceSchedule dayOfMonth(Integer dayOfMonth) {
        this.dayOfMonth = dayOfMonth;
        return this;
    }

    public void setDayOfMonth(Integer dayOfMonth) {
        this.dayOfMonth = dayOfMonth;
    }

    public Instant getEndsOn() {
        return endsOn;
    }

    public TBMaintenanceSchedule endsOn(Instant endsOn) {
        this.endsOn = endsOn;
        return this;
    }

    public void setEndsOn(Instant endsOn) {
        this.endsOn = endsOn;
    }

    public Integer getEndsAfterXOccurrences() {
        return endsAfterXOccurrences;
    }

    public TBMaintenanceSchedule endsAfterXOccurrences(Integer endsAfterXOccurrences) {
        this.endsAfterXOccurrences = endsAfterXOccurrences;
        return this;
    }

    public void setEndsAfterXOccurrences(Integer endsAfterXOccurrences) {
        this.endsAfterXOccurrences = endsAfterXOccurrences;
    }

    public Instant getCreatedDate() {
        return createdDate;
    }

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

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

    public Instant getModifiedDate() {
        return modifiedDate;
    }

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

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

    public Instant getDeletedDate() {
        return deletedDate;
    }

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

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

    public TBDetailUser getCreatedBy() {
        return createdBy;
    }

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

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

    public TBDetailUser getModifiedBy() {
        return modifiedBy;
    }

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

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

    public TBDetailUser getDeletedBy() {
        return deletedBy;
    }

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

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

    @Override
    public String toString() {
        return "TBMaintenanceSchedule{" +
            "id=" + getId() +
            ", description='" + getDescription() + "'" +
            ", isRepeat=" + getIsRepeat() +
            ", repeatEvery='" + getRepeatEvery() + "'" +
            ", isRepeatOnSunday=" + getIsRepeatOnSunday() +
            ", isRepeatOnMonday=" + getIsRepeatOnMonday() +
            ", isRepeatOnTuesday=" + getIsRepeatOnTuesday() +
            ", isRepeatOnWednesday=" + getIsRepeatOnWednesday() +
            ", isRepeatOnThursday=" + getIsRepeatOnThursday() +
            ", isRepeatOnFriday=" + getIsRepeatOnFriday() +
            ", isRepeatOnSaturday=" + getIsRepeatOnSaturday() +
            ", dayOfMonth=" + getDayOfMonth() +
            ", endsOn='" + getEndsOn() + "'" +
            ", endsAfterXOccurrences=" + getEndsAfterXOccurrences() +
            ", createdDate='" + getCreatedDate() + "'" +
            ", modifiedDate='" + getModifiedDate() + "'" +
            ", deletedDate='" + getDeletedDate() + "'" +
            "}";
    }
}
