package com.sundot.airport.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 时间范围枚举
 *
 * @author Simon Lin
 * @date 2026-01-29
 */
@Getter
@AllArgsConstructor
public enum TimeRangeEnum {

    TODAY("TODAY", "今日"),
    WEEK("WEEK", "本周"),
    MONTH("MONTH", "本月"),
    YEAR("YEAR", "本年");

    private final String code;
    private final String desc;

    public static TimeRangeEnum getByCode(String code) {
        for (TimeRangeEnum item : TimeRangeEnum.values()) {
            if (item.getCode().equals(code)) {
                return item;
            }
        }
        return null;
    }
}
