/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.arrebol.taxiservicios.model.catalog;

import com.arrebol.taxiservicios.model.core.User;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;

/**
 *
 * @author Picasso
 */
public class Holiday implements Serializable {

    private static final long serialVersionUID = 1487732423903657499L;

    private String id;
    private Date holiday;
    private String description;
    private User createdBy;
    private Date createdOn;
    private User lastUpdatedBy;
    private Date lastUpdatedOn;

    public Holiday() {
    }

    /**
     *
     * @param id
     */
    public Holiday(String id) {
        this.id = id;
    }

    /**
     *
     * @param holiday
     * @param description
     */
    public Holiday(Date holiday, String description) {
        this.holiday = holiday;
        this.description = description;
    }

    /**
     *
     * @param holiday
     */
    public Holiday(Date holiday) {
        this.holiday = holiday;
    }

    /**
     *
     * @param id
     * @param holiday
     */
    public Holiday(String id, Date holiday) {
        this.id = id;
        this.holiday = holiday;
    }

    /**
     *
     * @param id
     * @param holiday
     * @param description
     */
    public Holiday(String id, Date holiday, String description) {
        this.id = id;
        this.holiday = holiday;
        this.description = description;
    }

    public Holiday(String id, Date holiday, String description, User createdBy, Date createdOn, User lastUpdatedBy, Date lastUpdatedOn) {
        this.id = id;
        this.holiday = holiday;
        this.description = description;
        this.createdBy = createdBy;
        this.createdOn = createdOn;
        this.lastUpdatedBy = lastUpdatedBy;
        this.lastUpdatedOn = lastUpdatedOn;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getHoliday() {
        return holiday;
    }

    public void setHoliday(Date holiday) {
        this.holiday = holiday;
    }

    public String getDescription() {
        return description;
    }

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

    public User getCreatedBy() {
        return createdBy;
    }

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

    public Date getCreatedOn() {
        return createdOn;
    }

    public void setCreatedOn(Date createdOn) {
        this.createdOn = createdOn;
    }

    public User getLastUpdatedBy() {
        return lastUpdatedBy;
    }

    public void setLastUpdatedBy(User lastUpdatedBy) {
        this.lastUpdatedBy = lastUpdatedBy;
    }

    public Date getLastUpdatedOn() {
        return lastUpdatedOn;
    }

    public void setLastUpdatedOn(Date lastUpdatedOn) {
        this.lastUpdatedOn = lastUpdatedOn;
    }

    @Override
    public String toString() {
        return "Holiday{" + "id=" + id + ", holiday=" + holiday + ", description=" + description + '}';
    }

    @Override
    public int hashCode() {
        int hash = 5;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }

        final Holiday other = (Holiday) obj;

        Calendar c = Calendar.getInstance();
        Calendar c2 = Calendar.getInstance();

        c.setTime(this.holiday);
        c2.setTime(other.holiday);

        c.set(Calendar.HOUR_OF_DAY, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);

        c2.set(Calendar.HOUR_OF_DAY, 0);
        c2.set(Calendar.MINUTE, 0);
        c2.set(Calendar.SECOND, 0);
        c2.set(Calendar.MILLISECOND, 0);
        // c.getTime() =  (java.util.Date) Sat May 04 00:00:00 CDT 2019
        // c2.getTime() = (java.util.Date) Sat May 04 00:00:00 CDT 2019
        if (!Objects.equals(c.getTime(), c2.getTime())) {
            return false;
        }
        return true;
    }

}
