package com.fzm.mall.server.admin.home_page.enums.type;

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

/**
 * @author wangp
 * @date 2021/3/5 14:18
 * @description 修改密码方式
 * @since JDK 1.8
 */
public enum RepairPwdTypeEnum {

    PWD(1),//原密码
    SMS(2),//短信
    RESET(3);//重置

    private Integer type;

    RepairPwdTypeEnum(Integer type) {
        this.type = type;
    }

    public Integer getType() {
        return type;
    }

    public static List<Integer> getValueList() {
        return Arrays.stream(RepairPwdTypeEnum.values())
                .map(RepairPwdTypeEnum::getType)
                .collect(Collectors.toList());
    }

    public static RepairPwdTypeEnum getByType(Integer type) {
        for (RepairPwdTypeEnum v : values()) {
            if (v.type.equals(type)) {
                return v;
            }
        }
        return null;
    }
}
