package com.usky.rule.enums;

public enum TimeTypeEnum {
    HOUR("hour"),
    DAY("day"),
    WEEK("week"),
    MONTH("month"),
    YEAR("year");

    private final String identifier;

    public String getIdentifier() {
        return this.identifier;
    }

    private TimeTypeEnum(String identifier) {
        this.identifier = identifier;
    }

    public static TimeTypeEnum get(String identifier) {
        for(TimeTypeEnum timeTypeEnum : values()) {
            if (timeTypeEnum.getIdentifier().equals(identifier)) {
                return timeTypeEnum;
            }
        }

        throw new IllegalArgumentException("不支持的时间类型");
    }
}
