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

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

/**
 * @author wangp
 * @date 2021/3/29 16:40
 * @description 管理员归属
 * @since JDK 1.8
 */
public enum AdminTypeEnum {

    PLATFORM_ADMINISTRATOR(1),//平台超级管理员
    MERCHANT(2),//商户
    PLATFORM_MERCHANT(3),//平台商户
    PLATFORM(4);//平台

    private Integer type;

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

    public Integer getType() {
        return type;
    }

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

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

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

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


}
