class RegistryResponseValidator implements Validator<EbXMLRegistryResponse, ValidationProfile> {

    @Override
    public void validate(EbXMLRegistryResponse response, ValidationProfile profile) {
        notNull(response, "response cannot be null");
        
        metaDataAssert(response.getStatus() != null, INVALID_STATUS_IN_RESPONSE);
        for (EbXMLRegistryError registryError : response.getErrors()) {
            metaDataAssert(registryError != null, INVALID_ERROR_INFO_IN_RESPONSE);
            metaDataAssert(registryError.getErrorCode() != null, INVALID_ERROR_CODE_IN_RESPONSE);
            metaDataAssert(registryError.getSeverity() != null, INVALID_SEVERITY_IN_RESPONSE);

            if (profile.getProfile() == ValidationProfile.InteractionProfile.XCA) {
                hcValidator.validate(registryError.getLocation());
            }
        }
    }

}