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

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

/**
 * 优惠券类型
 * @author: Eric
 * @date: 2022-03-30
 */
public enum CouponTypeEnum implements BaseEnum<String, CouponTypeEnum> {

    FULL_DISCOUNT("满减券"),
    VOUCHER("代金券"),
    ;

    @EnumValue
    private String code;
    private String msg;

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

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

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

        return false;
    }
}
