package com.bonus.system.holiday.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.bonus.common.core.web.domain.BaseBean;
import com.bonus.system.att.entity.Holiday;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.time.LocalDate;
import java.util.Date;

/**
 * LeaveApply
 *
 */
@Data
public class HolidayImportBean {




    private Long orgId;

    /**
     * 所属部门名称
     */
    @NotBlank(message = "部门不能为空", groups = {Query.class})
    @Length(max = 32, message = "部门名称长度不能超过32", groups = {Query.class})
    private String orgName;

    private Long userId;

    /**
     * 请假人姓名
     */
    @NotBlank(message = "姓名不能为空", groups = {Query.class})
    @Length(max = 32, message = "姓名字符长度不能超过32", groups = {Query.class})
    private String userName;

    /**
     * 请假开始日期
     */
    @NotBlank(message = "请假开始日期不能为空", groups = {Query.class})
    private String leaveStartDate;
    /**
     * 请假开始时段1上午2下午
     */
    private String leaveStartInterval;
    /**
     * 请假结束日期
     */
    @NotBlank(message = "请假结束日期不能为空", groups = {Query.class})
    private String leaveEndDate;
    /**
     * 请假结束时段1上午2下午
     */
    private String leaveEndInterval;
    /**
     * 请假时长
     */
    @NotBlank(message = "请假时长不能为空", groups = {Query.class})
    private String leaveDuration;
    /**
     * 请假事由
     */
    @NotBlank(message = "请假事由不能为空", groups = {Query.class})
    private String leaveReason;

    /**
     * 请假类型
     */
    @NotBlank(message = "请假类型不能为空", groups = {Query.class})
    private String leaveType;

    /**
     * 请假日期
     */
    @NotBlank(message = "申请时间不能为空", groups = {Query.class})
    private String leaveDate;


    /**
     * 数据来源1新增2导入
     */
    private String source;
    /**
     * 审批状态0审核中1通过2不通过
     */
    private String examineStatus;

    /**
     * 查询条件限制
     */
    public interface Query {
    }

    // 检查两个请假记录是否重叠
    public boolean isOverlapping(HolidayImportBean other) {
        return (this.leaveStartDate.compareTo(other.leaveEndDate) <= 0) &&
                (this.leaveEndDate.compareTo(other.leaveStartDate) >= 0);
    }

}
