package com.mortals.xhx.common.code;

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

public enum ImageReEnum {
    RE_1920X1080(0, "1920x1080"),
    RE_1080X1920(1, "1080x1920"),
    RE_1280X1280(2, "1280x1280");
    private Integer value;
    private String desc;

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

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

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

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

    /**
    * 获取Map集合
    *
    * @param eItem 不包含项
    * @return
    */
    public static Map<String, String> getEnumMap(Integer... eItem) {
        Map<String, String> resultMap = new LinkedHashMap<>();
        for (ImageReEnum item : ImageReEnum.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;
    }
}