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

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

/**
 * 课程关联类型
 * @author: Eric
 * @date: 2022-03-30
 */
public enum CourseRelationTypeEnum implements BaseEnum<String, CourseRelationTypeEnum> {

    RECOMMEND("推荐"),
    GIFT("赠品"),
    ;

    @EnumValue
    private String code;
    private String msg;

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

    public String getMsg() {
        return this.msg;
    }

    public String getCode() {
        return code;
    }

    /**
     * 类型匹配
     * @param name 类型
     * @return boolean
     */
    public static boolean match(String name) {

        CourseRelationTypeEnum[] values = CourseRelationTypeEnum.values();
        for (CourseRelationTypeEnum item : values) {

            if (item.name().equals(name)) {
                return true;
            }
        }

        return false;
    }
}
