package com.hfkj.sysenum.discount;
import lombok.Getter;
import java.util.Objects;

/**
 * 优惠券状态
 * @author hurui
 */
@Getter
public enum DiscountTypeEnum {
    /**
     type1(1 , "满减"),
     *
     */
    type1(1 , "满减"),
    /**
     * 抵扣
     */
    type2(2 , "抵扣"),
    /**
     * 折扣
     */
    type3(3 , "折扣"),
    ;

    private Integer code;
    private String name;

    DiscountTypeEnum(int code , String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByType(Integer code) {
        for (DiscountTypeEnum ele : values()) {
            if(Objects.equals(code,ele.getCode())) return ele.getName();
        }
        return null;
    }
}
