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

import com.fzm.mall.server.admin.enums.log.OperateModuleEnum;

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

/**
 * @author wangp
 * @date 2021/5/6 17:38
 * @description 收信人类别
 * @since JDK 1.8
 */
public enum AddresseeTypeEnum {
    SELF_DEFINE(1),//自定义
    ALL_USER(2),//所有用户
    ALL_MERCHANT(3);//所有商户

    private Integer type;

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

    public Integer getType() {
        return type;
    }

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

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