package com.ai.da.common.enums;

import lombok.Getter;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author: yanglei
 * @description: 当前的需要design的图片类型 计算用
 * @create: 2022-11-19 17:33
 **/
@Getter
public enum CurrentDesignPictureTypeEnum {
    /**
     * PIN
     */
    PIN(1, "PIN"),
    /**
     * USER_LIBRARY
     */
//    USER_LIBRARY(2, "userLibrary"),
    /**
     * SYS_FILE
     */
    SYS_FILE(2, "sysFile"),
    /**
     * noPIN
     */
    NO_PIN(3, "noPIN");

    private Integer code;
    private String desc;

    CurrentDesignPictureTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static CurrentDesignPictureTypeEnum of(String name) {
        return Stream.of(CurrentDesignPictureTypeEnum.values()).filter(v -> v.name().equals(name)).findFirst().orElse(null);
    }

    public static List<CurrentDesignPictureTypeEnum> ofList(List<Integer> codes) {
        return Stream.of(CurrentDesignPictureTypeEnum.values()).filter(v -> codes.contains(v.code)).collect(Collectors.toList());
    }
}
