package cn.estsh.i3plus.pojo.aps.model;

import lombok.Data;

import java.util.Date;

/**
 * @Description :时间段信息，包含指示该时间段是上班还是下班
 * @Reference :
 * @Author : jason.niu
 * @CreateDate : 2019-09-17
 * @Modify:
 **/
@Data
public class TimeBlock implements Comparable<TimeBlock> {
    private Date begin;
    private Date end;
    private boolean onDuty = true;
    private String shift;

    @Override
    public int compareTo(TimeBlock o) {
        if (this.getBegin().equals(o.getBegin())) {
            if (this.getEnd().equals(o.getEnd())) {
                return 0;
            }
            return this.getEnd().before(o.getEnd()) ? -1 : 1 ;
        }
        return this.getBegin().before(o.getBegin()) ? -1 : 1;
    }
}
