package com.cpop.core.base.enums;

import com.cpop.core.strategy.login.LoginStrategy;
import com.cpop.core.strategy.login.MallLoginStrategy;
import com.cpop.core.strategy.login.MiniLoginStrategy;
import com.cpop.core.strategy.login.OamLoginStrategy;
import com.cpop.core.utils.SpringUtils;
import lombok.Getter;

/**
 * 用户类型
 * @author DB
 */
@Getter
public enum UserType {

    /**
     * oam系统员工
     */
    OAM_USER(0, "oam:loginUser:", SpringUtils.getBean(OamLoginStrategy.class)),
    /**
     * 小程序用户
     */
    MINI_USER(1, "mini:loginUser:", SpringUtils.getBean(MiniLoginStrategy.class)),
    /**
     * 商城系统员工
     */
    MALL_USER(2, "mall:loginUser:",SpringUtils.getBean(MallLoginStrategy.class));

    /**
     * code
     */
    private final Integer code;

    /**
     * redisKey
     */
    private final String key;

    private final LoginStrategy strategy;

    UserType(Integer code, String key, LoginStrategy strategy) {
        this.code = code;
        this.key = key;
        this.strategy = strategy;
    }

}
