package jnpf.enums.attendance;

/**
 * 打卡状态枚举
 *
 * @author yanwenfu
 * @create 2023-09-18
 */
public enum ClockInStatusEnum {

    /** 无需打卡 */
    NEED_NOT(-2, "无需打卡"),
    /** 缺卡 */
    NO_CLOCK(-1, "缺卡"),
    /** 正常 */
    NORMAL(1, "正常"),
    /** 迟到 */
    WORK_LATE(2, "迟到"),
    /** 早退 */
    HOME_EARLY(3, "早退"),
    /** 旷工 */
    ABSENCE(4, "旷工"),
    /** 撤销变更 */
    ROLLBACK(99, "撤销变更"),
    /** 无实意(防止查询的打卡状态是空) */
    UNUSED(999, "无实意"),
    ;

    private final Integer value;

    private final String description;

    ClockInStatusEnum(Integer value, String description) {
        this.value = value;
        this.description = description;
    }

    public static ClockInStatusEnum getClockInStatusEnum(int status) {

        ClockInStatusEnum[] values = ClockInStatusEnum.values();
        for (ClockInStatusEnum value : values) {
            if (value.getValue() == status) {
                return value;
            }
        }
        return null;
    }

    public Integer getValue() {
        return value;
    }

    public String getDescription() {
        return description;
    }
}
