package com.bocloud.cmp.model.hmc.enums;

import java.util.Arrays;
import java.util.Optional;

public enum ShareProcessorType {
    CAPPED("capped"),
    UNCAPPED("uncapped"),
    SHARE_ALWAYS("sre idle procs always"),
    SHARE_WHEN_UNACTIVE("sre idle proces"),
    SHARE_WHEN_ACTIVE("sre idle procs active"),
    SHARE_NEVER("keep idle procs");
    private final String type;

    ShareProcessorType(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public static Optional<ShareProcessorType> byTypeOpt(String type) {
        return Arrays.stream(ShareProcessorType.values()).filter(t -> t.getType().equals(type)).findFirst();
    }

    public static ShareProcessorType byTypeNullable(String type) {
        return byTypeOpt(type).orElse(null);
    }
}
