package com.atlassian.stash.internal.notification.usersettings;

import com.atlassian.bitbucket.user.ApplicationUser;

import javax.annotation.Nonnull;

/**
 * Service to manage email notification settings for a user.
 */
public interface UserNotificationSettingsService {

    /**
     * Get the UserNotificationSettings for a ApplicationUser.
     *
     * @param user the ApplicationUser whose settings should be returned
     * @return the notification settings for the user
     */
    @Nonnull
    UserNotificationSettings getSettingsForUser(@Nonnull ApplicationUser user);

    /**
     * Update the {@link UserNotificationSettings} for a ApplicationUser. This will merge the provided {@link UserNotificationSettings}
     * with any existing settings, so only the values that are required to be updated need to be provided.
     *
     * @param user the ApplicationUser to update settings for
     * @param userNotificationSettings the settings to be updated
     */
    void updateSettingsForUser(@Nonnull ApplicationUser user, @Nonnull UserNotificationSettings userNotificationSettings);
}
