package com.mortals.xhx.common.code;

import java.util.LinkedHashMap;
import java.util.Map;

/**
* 请假类型(1.事假,2.调休,3.病假,4.年假,5.产假,6.陪产假,7.婚假,8.例假,9.哺乳假,10.丧假)枚举类
*
* @author zxfei
*/
public enum LeaveTypeEnum {
    事假(1, "事假"),
    调休(2, "调休"),
    病假(3, "病假"),
    年假(4, "年假"),
    产假(5, "产假"),
    陪产假(6, "陪产假"),
    婚假(7, "婚假"),
    例假(8, "例假"),
    哺乳假(9, "哺乳假"),
    丧假(10, "丧假"),
    回单位(11, "回单位"),
    因公请假(12, "因公请假"),
    外出勘验(13, "外出勘验"),
    值班补班(14, "值班补班"),
    体检(15, "体检"),
    隔离(16, "隔离"),
    因公外出(17, "因公外出"),
    公休(18, "公休"),
    育儿假(19, "育儿假"),
    调回单位(20, "调回单位"),
    探亲假(21, "探亲假"),
    其他(22, "其他"),
    上年公休结余(23, "上年公休结余"),
    独生子女陪护假(24, "独生子女陪护假,"),
    陪护假(25, "陪护假"),
    税务调休(26, "税务调休"),
    税务年假(27, "税务年假"),
    税务陪产假(28, "税务陪产假"),
    税务上年公休结余(29, "税务上年公休结余"),
    税务育儿假(30, "税务育儿假"),
    ;

    private Integer value;
    private String desc;

    LeaveTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return this.desc;
    }

    public static LeaveTypeEnum getByValue(Integer value) {
        for (LeaveTypeEnum leaveTypeEnum : LeaveTypeEnum.values()) {
            if (leaveTypeEnum.getValue() == value) {
                return leaveTypeEnum;
            }
        }
        return null;
    }

    /**
    * 获取Map集合
    *
    * @param eItem 不包含项
    * @return
    */
    public static Map<String, String> getEnumMap(Integer... eItem) {
        Map<String, String> resultMap = new LinkedHashMap<>();
        for (LeaveTypeEnum item : LeaveTypeEnum.values()) {
            try {
                boolean hasE = false;
                for (Integer e : eItem) {
                    if (item.getValue() == e) {
                        hasE = true;
                        break;
                    }
                }
                if (!hasE) {
                    resultMap.put(item.getValue() + "", item.getDesc());
                }
            } catch (Exception ex) {

            }
        }
        return resultMap;
    }
}