class CertFailedRefreshNotificationTask implements NotificationTask {

    @Override
    public List<Notification> getNotifications() {
        if (providers == null || providers.isEmpty()) {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("No configured providers");
            }
            return new ArrayList<>();
        }

        List<X509CertRecord> unrefreshedCerts = new ArrayList<>();
        for (String provider : providers) {
            unrefreshedCerts.addAll(instanceCertManager.getUnrefreshedCertsNotifications(serverName, provider));
        }
        if (unrefreshedCerts.isEmpty()) {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("No unrefreshed certificates available to send notifications");
            }
            return new ArrayList<>();
        }

        List<X509CertRecord> unrefreshedCertsValidServices = getRecordsWithValidServices(unrefreshedCerts);
        if (unrefreshedCertsValidServices.isEmpty()) {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("No unrefreshed certificates with configured services available to send notifications");
            }
            return new ArrayList<>();
        }

        List<X509CertRecord> unrefreshedCertsValidHosts = getRecordsWithValidHosts(unrefreshedCertsValidServices);
        if (unrefreshedCertsValidHosts.isEmpty()) {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("No unrefreshed certificates with valid hosts available to send notifications");
            }
            return new ArrayList<>();
        }

        Map<String, List<X509CertRecord>> domainToCertRecordsMap = getDomainToCertRecordsMap(unrefreshedCertsValidHosts);

        return generateNotificationsForAdmins(domainToCertRecordsMap);
    }

    public  CertFailedRefreshNotificationTask(InstanceCertManager instanceCertManager,
                                             DataStore dataStore,
                                             HostnameResolver hostnameResolver,
                                             String userDomainPrefix,
                                             String serverName,
                                             int httpsPort);

}