class RoleMemberNotificationCommon {

    public List<Notification> getNotificationDetails(Map<String, DomainRoleMember> members,
                                                     NotificationToEmailConverter principalNotificationToEmailConverter,
                                                     NotificationToEmailConverter domainAdminNotificationToEmailConverter,
                                                     RoleMemberDetailStringer roleMemberDetailStringer,
                                                     String notificationType) {
        // first we're going to send reminders to all the members indicating to
        // them that they're going to expiry (or nearing review date) and they should follow up with
        // domain admins to extend their membership.
        // if the principal is service then we're going to send the reminder
        // to the domain admins of that service
        // while doing this we're going to keep track of all domains that
        // have members that are about to expire (or pass their review date) and then send them a reminder
        // as well indicating that they have members with coming-up expiration

        List<Notification> notificationList = new ArrayList<>();
        Map<String, List<MemberRole>> domainAdminMap = new HashMap<>();

        for (DomainRoleMember roleMember : members.values()) {

            // we're going to process the role member, update
            // our domain admin map accordingly and return
            // the details object that we need to send to the
            // notification agent for processing

            Map<String, String> details = processRoleReminder(domainAdminMap, roleMember, roleMemberDetailStringer);
            Notification notification = notificationCommon.createNotification(
                    roleMember.getMemberName(),
                    details,
                    principalNotificationToEmailConverter,
                    notificationType);
            if (notification != null) {
                notificationList.add(notification);
            }
        }

        // now we're going to send reminders to all the domain administrators

        for (Map.Entry<String, List<MemberRole>> domainAdmin : domainAdminMap.entrySet()) {

            Map<String, String> details = processMemberReminder(domainAdmin.getKey(), domainAdmin.getValue(), roleMemberDetailStringer);
            Notification notification = notificationCommon.createNotification(
                    ZMSUtils.roleResourceName(domainAdmin.getKey(), ADMIN_ROLE_NAME),
                    details,
                    domainAdminNotificationToEmailConverter,
                    notificationType);
            if (notification != null) {
                notificationList.add(notification);
            }
        }

        return notificationList;
    }

    public  RoleMemberNotificationCommon(DBService dbService, String userDomainPrefix);

}