package com.yonge.cooleshow.auth.enums;

import com.yonge.toolset.base.enums.BaseEnum;

/**
 * Description
 *
 * @author liujunchi
 * @date 2022-04-28
 */
public enum EClientType implements BaseEnum<String, EClientType> {
    TEACHER("老师端"),
    STUDENT("学生端"),
    TENANT_STUDENT("机构-学生端"),
    ORGANIZATION("机构-小程序"),
    SYSTEM("平台端"),
    WEBSITE("官网"),
    ;
    private String code;
    private String msg;

    EClientType(String msg) {
        this.code = this.name();
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    /**
     * 校验客户端类型合法性
     * @param clientType 客户端类型
     * @return boolean
     */
    public static boolean invalid(String clientType) {

        EClientType[] values = EClientType.values();

        for (EClientType item : values) {

            if (item.getCode().equals(clientType)) {
                return false;
            }
        }

        return true;
    }

    /**
     * 客户端类型匹配
     * @param type 类型
     * @return boolean
     */
    public boolean match(String type) {

        return getCode().equals(type);
    }

}
