package com.mortals.xhx.common.code;

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

public enum AllHolidaysEnum {
    事假("personalLeaveDays", "1"),
    调休("compensatedLeaveDays", "2"),
    病假("sickLeaveDays", "3"),
    年假("annualLeaveDays", "4"),
    产假("maternityLeaveDays", "5"),
    陪产假("paternityLeaveDays", "6"),
    婚假("marriageLeaveDays", "7"),
    例假("menstrualLeaveDays", "8"),
    哺乳假("breastfeedingLeaveDays", "9"),
    丧假("bereavementLeaveDays", "10"),
    回单位("backToUnit", "11"),
    因公请假("onDutyLeave", "12"),
    外出勘验("outOfOffice", "13"),
    值班补班("shiftCompensation", "14"),
    体检("physicalExamination", "15"),
    隔离("quarantine", "16"),
    因公外出与窗口工作无关("businessTrip", "17"),
    公休("publicHoliday", "18"),
    育儿假("childRearingLeave", "19"),
    调回单位或离职("transferBack", "20"),
    探亲假("homeLeave", "21");


    private String value;
    private String desc;

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

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

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

    public static AllHolidaysEnum getByValue(String value) {
        for (AllHolidaysEnum allHolidaysEnum : AllHolidaysEnum.values()) {
            if (allHolidaysEnum.getValue() == value) {
                return allHolidaysEnum;
            }
        }
        return null;
    }

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

            }
        }
        return resultMap;
    }
}
