package com.ruoyi.clock.exception;

import com.ruoyi.common.enums.IIntegerEnum;
import java.util.Objects;


/**
 * 异常枚举
 */
public enum ActivityExceptionEnum implements IIntegerEnum {

    // TODO 注意检查错误码，保证系统内唯一
    ACTIVITY_IS_NOT_EXISTS(200001, "活动信息不存在"),
    ACTIVITY_AGENT_IS_EMPTY(200002, "活动参与代理商信息不能为空"),
    ACTIVITY_PRODUCT_IS_EMPTY(200003, "活动产品信息不能为空"),

    ;

    private Integer code;

    private String msg;

    ActivityExceptionEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public Integer getCode() {
        return code;
    }

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

    @Override
    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static ActivityExceptionEnum getByCode(int code, ActivityExceptionEnum[] values) {
        for (ActivityExceptionEnum value : values) {
            if (Objects.equals(code, value.getCode())) {
                return value;
            }
        }
        return null;
    }

}
