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

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

public enum VirtualFabricAdapterType {
    CLIENT("Client"),
    SERVER("Server");
    private final String type;

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

    public String getType() {
        return type;
    }

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

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