class SimpleCapacityGuaranteeStrategy implements CapacityGuaranteeStrategy {

    @Override
    public CapacityAllocations compute(CapacityRequirements capacityRequirements) {
        Map<AgentInstanceGroup, Integer> instanceAllocations = new HashMap<>();
        Map<Tier, ResourceDimension> resourceShortage = new HashMap<>();
        for (Tier tier : capacityRequirements.getTiers()) {
            // In Flex tier we have always 'DEFAULT' app, and if it is the only one, we should not scale the cluster
            // For other tiers we stop scaling, if there are no application SLAs configured
            boolean hasEnoughApps = (tier == Tier.Flex && capacityRequirements.getTierRequirements(tier).size() > 1)
                    || (tier != Tier.Flex && capacityRequirements.getTierRequirements(tier).size() > 0);
            if (hasEnoughApps) {
                Optional<ResourceDimension> left = allocate(tier, capacityRequirements, instanceAllocations);
                left.ifPresent(resourceDimension -> resourceShortage.put(tier, resourceDimension));
            }
        }
        return new CapacityAllocations(instanceAllocations, resourceShortage);
    }

    @Inject public  SimpleCapacityGuaranteeStrategy(CapacityManagementConfiguration configuration,
                                           AgentManagementService agentManagementService,
                                           ServerInfoResolver serverInfoResolver);

}