class HostedVespaClusterPolicy implements ClusterPolicy {

    ConcurrentSuspensionLimitForCluster getConcurrentSuspensionLimit(ClusterApi clusterApi) {
        if (clusterApi.isStorageCluster()) {
            return ConcurrentSuspensionLimitForCluster.ONE_NODE;
        }

        if (VespaModelUtil.CLUSTER_CONTROLLER_SERVICE_TYPE.equals(clusterApi.serviceType())) {
            // All nodes have all state and we need to be able to remove the half that are retired on cluster migration
            return ConcurrentSuspensionLimitForCluster.FIFTY_PERCENT;
        }

        if (VespaModelUtil.METRICS_PROXY_SERVICE_TYPE.equals(clusterApi.serviceType())) {
            return ConcurrentSuspensionLimitForCluster.ALL_NODES;
        }

        if (VespaModelUtil.ADMIN_CLUSTER_ID.equals(clusterApi.clusterId())) {
            if (VespaModelUtil.SLOBROK_SERVICE_TYPE.equals(clusterApi.serviceType())) {
                return ConcurrentSuspensionLimitForCluster.ONE_NODE;
            }

            return ConcurrentSuspensionLimitForCluster.ALL_NODES;
        }

        if (clusterApi.getApplication().applicationId().equals(VespaModelUtil.TENANT_HOST_APPLICATION_ID)) {
            return ConcurrentSuspensionLimitForCluster.TWENTY_PERCENT;
        }

        return ConcurrentSuspensionLimitForCluster.TEN_PERCENT;
    }

}