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

import java.util.Arrays;
import java.util.List;

/**
 * @author wangp
 * @date 2021/4/8 17:01
 * @description 管理员角色类型
 * @since JDK 1.8
 */
public enum AdminRoleTypeEnum {

    PLATFORM_DEFAULT(1),//平台默认
    MERCHANT_DEFAULT(2),//商户默认
    PLATFORM_MERCHANT_DEFAULT(3),//平台商户默认
    PLATFORM(4),//平台角色
    MERCHANT(5),//商户角色
    PLATFORM_MERCHANT(6);//平台商户角色

    private Integer type;

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

    public Integer getType() {
        return type;
    }

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

    public static List<Integer> getValueList() {
        Integer[] arr = new Integer[3];
        arr[0] = PLATFORM.getType();
        arr[1] = MERCHANT.getType();
        arr[2] = PLATFORM_MERCHANT.getType();
        return Arrays.asList(arr);
    }

    public static Integer[] getPlatformDefaultValueList() {
        Integer[] arr = new Integer[2];
        arr[0] = PLATFORM_DEFAULT.getType();
        arr[1] = PLATFORM.getType();
        return arr;
    }

    public static Integer[] getMerchantDefaultValueList() {
        Integer[] arr = new Integer[2];
        arr[0] = MERCHANT_DEFAULT.getType();
        arr[1] = MERCHANT.getType();
        return arr;
    }

    public static Integer[] getPlatformMerchantDefaultValueList() {
        Integer[] arr = new Integer[2];
        arr[0] = PLATFORM_MERCHANT_DEFAULT.getType();
        arr[1] = PLATFORM_MERCHANT.getType();
        return arr;
    }
}
