package p.packer.messages.assets;

import java.util.Locale;

public enum OutputCodecCatalog {
    NONE("NONE", "None"),
    UNKNOWN("UNKNOWN", "Unknown");

    private final String manifestValue;
    private final String displayName;

    OutputCodecCatalog(String manifestValue, String displayName) {
        this.manifestValue = manifestValue;
        this.displayName = displayName;
    }

    public String manifestValue() {
        return manifestValue;
    }

    public String displayName() {
        return displayName;
    }

    public static OutputCodecCatalog fromManifestValue(String manifestValue) {
        if (manifestValue == null) {
            return UNKNOWN;
        }
        final String normalized = manifestValue.trim().toUpperCase(Locale.ROOT);
        for (OutputCodecCatalog candidate : values()) {
            if (candidate.manifestValue.equals(normalized)) {
                return candidate;
            }
        }
        return UNKNOWN;
    }
}
