package com.zcxk.rmcp.api.enums;

import com.zcxk.core.common.exception.BusinessException;
import lombok.Getter;

/**
 * @author Andy
 * @date 2021-07-20 11:46
 */
@Getter
public enum ReadRateEnum {

    /**
     * 今天
     */
    TODAY(1, "今日"),

    /**
     * 昨天
     */
    YESTERDAY(2, "昨日"),

    /**
     * 7天
     */
    SEVEN_DAY(3, "近7日"),

    /**
     * 月
     */
    MONTH(4, "上月"),

    ;

    /**
     * code
     */
    private final int code;

    /**
     * 说明
     */
    private final String message;


    ReadRateEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public static ReadRateEnum getReadRateEnum(int code){
        for (ReadRateEnum value : ReadRateEnum.values()) {
             if (value.code == code) {
                 return value;
             }
        }
        throw BusinessException.builder(RmcpErrorEnum.RMCP_NOT_FOUND_CODE);
    }


}
