All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.metaeffekt.mirror.contents.eol.state.SupportState Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2021-2024 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.metaeffekt.mirror.contents.eol.state;

import com.metaeffekt.artifact.analysis.dashboard.SvgIcon;
import org.metaeffekt.core.util.ColorScheme;

public enum SupportState {
    NO_SUPPORT(SvgIcon.X_OCTAGON_FILL, "No support", ColorScheme.STRONG_RED),
    SUPPORT(SvgIcon.CHECK_CIRCLE_FILL, "Support available", ColorScheme.STRONG_DARK_GREEN),
    SUPPORT_END_DATE_REACHED(SvgIcon.X_OCTAGON_FILL, "Support end reached", ColorScheme.STRONG_RED),
    DISTANT_SUPPORT_END_DATE(SvgIcon.CHECK_CIRCLE_FILL, "Upcoming support end", ColorScheme.STRONG_DARK_GREEN),
    UPCOMING_SUPPORT_END_DATE(SvgIcon.EXCLAMATION_TRIANGLE_FILL, "Upcoming support end", ColorScheme.STRONG_YELLOW);

    private final SvgIcon icon;
    private final String shortDescription;
    private final ColorScheme color;

    SupportState(SvgIcon icon, String shortDescription, ColorScheme color) {
        this.icon = icon;
        this.shortDescription = shortDescription;
        this.color = color;
    }

    public SvgIcon getIcon() {
        return icon;
    }

    public String getShortDescription() {
        return shortDescription;
    }

    public static SupportState fromEolState(EolState eolState) {
        switch (eolState) {
            case NOT_EOL:
                return SUPPORT;
            case EOL:
                return NO_SUPPORT;
            case EOL_DATE_REACHED:
                return SUPPORT_END_DATE_REACHED;
            case DISTANT_EOL_DATE:
                return DISTANT_SUPPORT_END_DATE;
            case UPCOMING_EOL_DATE:
                return UPCOMING_SUPPORT_END_DATE;
            default:
                throw new IllegalStateException("Unexpected value: " + eolState);
        }
    }

    public ColorScheme getColor() {
        return color;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy