package com.hfkj.sysenum.discount;

import java.util.Objects;

/**
 * 优惠券状态
 * @author hurui
 */
public enum DiscountStatusEnum {
    status0(0 , "删除"),
    status1(1 , "编辑中"),
    status2(2 , "已上线"),
    status3(3 , "已结束"),
    ;

    private Integer code;
    private String name;

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

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

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
