class DefaultLoadBalancerJobValidator implements LoadBalancerJobValidator {

    @Override
    public void validateJobId(String jobId) throws LoadBalancerException, JobManagerException {
        // Job must exist
        Job job = v3JobOperations.getJob(jobId).orElseThrow(() -> JobManagerException.v3JobNotFound(jobId));

        // Job must be active
        JobState state = job.getStatus().getState();
        if (state != JobState.Accepted) {
            throw JobManagerException.unexpectedJobState(job, JobState.Accepted);
        }

        // Must be a service job
        JobDescriptor.JobDescriptorExt extensions = job.getJobDescriptor().getExtensions();
        if (!(extensions instanceof ServiceJobExt)) {
            throw JobManagerException.notServiceJob(jobId);
        }

        // Job should have less than max current load balancer associations
        int maxLoadBalancers = loadBalancerValidationConfiguration.getMaxLoadBalancersPerJob();
        int numLoadBalancers = loadBalancerStore.getNumLoadBalancersForJob(jobId);
        if (numLoadBalancers > maxLoadBalancers) {
            throw LoadBalancerException.jobMaxLoadBalancers(jobId, numLoadBalancers, maxLoadBalancers);
        }
    }

    @Inject public  DefaultLoadBalancerJobValidator(V3JobOperations v3JobOperations,
                                           LoadBalancerStore loadBalancerStore,
                                           LoadBalancerValidationConfiguration loadBalancerValidationConfiguration);

}