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

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

public enum LogicalPartitionType {
    AIX_LINUX("AIX/Linux"),
    VIOS("Virtual IO Server"),
    IBMI("OS400");
    private final String type;

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

    public String getType() {
        return type;
    }

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

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