package com.yida.data.common.core.enums.attendance;

import cn.hutool.core.util.ObjectUtil;
import com.yida.data.common.core.enums.leave.LeaveRequestTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 考勤结果状态类别
 */
@Getter
@AllArgsConstructor
public enum AttendanceResultEnum {
    /**
     * 正常状态
     */
    NORMAL(0, "正常"),

    /**
     * 异常状态
     */
    ABNORMAL(1, "异常"),

    LATE(2, "迟到"),
    LEAVE(3, "早退"),
    LATE_LEAVE(4, "迟到+早退"),
    OUT(5, "旷工"),
    MISS(6, "缺卡"),
    LATE_DORM(7, "晚归"),
    AB_LATE_DORM(8, "异常晚归");

    private final Integer value;
    private final String name;


    public static String getName(Integer type) {
        for (AttendanceResultEnum typeEnum : AttendanceResultEnum.values()) {
            if (ObjectUtil.equals(typeEnum.value, type)) {
                return typeEnum.name;
            }
        }
        return null;
    }

}
