package com.iailab.module.data.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author PanZhibao
 * @Description
 * @createTime 2024年05月25日
 */
@Getter
@AllArgsConstructor
public enum IndTimeLimitEnum {

    TODAY("TODAY", "今天"),
    YESTERDAY("YESTERDAY", "昨天"),
    LAST_DAY_7("LAST_DAY_7", "最近7天"),
    LAST_DAY_30("LAST_DAY_30", "最近30天"),
    THIS_MONTH("THIS_MONTH", "当前月"),
    LAST_MONTH_12("LAST_MONTH_12", "最近12个月"),
    THIS_YEAR_MONTH("THIS_YEAR_MONTH", "当年月份"),
    LAST_YEAR("LAST_YEAR", "去年"),
    THIS_YEAR("THIS_YEAR_MONTH", "今年"),
    CUSTOM("CUSTOM", "自定义");

    private String code;
    private String desc;

    public static IndTimeLimitEnum getEumByCode(String code) {
        if (code == null) {
            return null;
        }

        for (IndTimeLimitEnum statusEnum : IndTimeLimitEnum.values()) {
            if (statusEnum.getCode().equals(code)) {
                return statusEnum;
            }
        }
        return null;
    }
}