package com.atlassian.bitbucket.notification.custom.pull;

import com.atlassian.bitbucket.pull.PullRequest;
import com.atlassian.bitbucket.user.ApplicationUser;

import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Map;

/**
 * Renders a custom pull request notification.
 *
 * @see CustomPullRequestNotificationEvent
 */
public interface CustomPullRequestNotificationRenderer {

    /**
     * @return ID that is used to uniquely identify this renderer
     */
    @Nonnull
    String getId();

    /**
     * Render a notification for the specified users and notification data.
     *
     * @param pullRequest the pull request that the notifications are about
     * @param userData a map from recipients to the notification data that were stored in this batch
     * @return a map from recipient to the rendered items. Note that the implementation is free to return as many items
     *         as it likes, condensing or even dropping items.
     */
    @Nonnull
    Map<ApplicationUser, Collection<CustomNotificationSection>> render(
            @Nonnull PullRequest pullRequest,
            @Nonnull Map<ApplicationUser, Collection<CustomNotificationData>> userData);
}
