package com.yonge.cooleshow.biz.dal.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.yonge.toolset.base.enums.BaseEnum;

/**
 * Description
 *
 * @author liujunchi
 * @date 2022-04-28
 */
public enum ClientEnum implements BaseEnum<String, ClientEnum> {
    TEACHER("老师端"),
    STUDENT("学生端"),
    SYSTEM("平台端"),
    WEBSITE("官网"),

    ;
    @EnumValue
    private String code;
    private String msg;

    ClientEnum( 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) {

        ClientEnum[] values = ClientEnum.values();

        for (ClientEnum item : values) {

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

        return true;
    }
}
