class CookbookConfigurationToscaConverter {

    public List<TNodeType> convertCookbookConfigurationToToscaNode(ChefCookbookConfiguration cookbookConfiguration, int counter) {
        List<TNodeType> nodeTypes = new ArrayList<>();
        String cookbookName = cookbookConfiguration.getName();
        String version = cookbookConfiguration.getVersion();

        String namespace = buildNamespaceForCookbookConfigs(cookbookName, version);

        TNodeType.Builder configurationNodeType = new TNodeType.Builder(cookbookName + WineryVersion.WINERY_VERSION_SEPARATOR + WineryVersion.WINERY_VERSION_PREFIX + counter);
        configurationNodeType.setTargetNamespace(namespace);

        TRequirementDefinition platform = convertPlatformToRequirement(cookbookConfiguration.getSupports(), namespace);
        configurationNodeType.addRequirementDefinitions(platform);

        TCapabilityDefinition installedPackage;
        List<TCapabilityDefinition> installedPackages = convertInstalledPackagesToCapabilities(cookbookConfiguration.getInstalledPackages(), namespace);
        for (int i = 0; i < installedPackages.size(); i++) {
            installedPackage = installedPackages.get(i);
            configurationNodeType.addCapabilityDefinitions(installedPackage);
        }

        TRequirementDefinition requiredPackage;
        List<TRequirementDefinition> requiredPackages = convertRequiredPackagesToRequirements(cookbookConfiguration.getRequiredPackages(), namespace);
        for (int i = 0; i < requiredPackages.size(); i++) {
            requiredPackage = requiredPackages.get(i);
            configurationNodeType.addRequirementDefinitions(requiredPackage);
        }

        TNodeType tNodeType = new TNodeType(configurationNodeType);

        TNodeType platformNodeType = convertPlatformToNodeType(cookbookConfiguration.getSupports(), namespace);

        nodeTypes.add(tNodeType);
        nodeTypes.add(platformNodeType);
        return nodeTypes;
    }

}