001/*
002 *  Copyright 2023 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.web.activities.notify;
017
018import java.util.List;
019import java.util.Map;
020
021import org.ametys.plugins.repository.activities.Activity;
022import org.ametys.plugins.repository.activities.ActivityType;
023import org.ametys.runtime.plugin.component.Supporter;
024
025/**
026 * Implementation to notify activity
027 */
028public interface ActivityNotifier extends Supporter<ActivityType>
029{
030    /**
031     * <code>true</code> if the notifier is asynchronous
032     * @return <code>true</code> if the notifier is asynchronous
033     */
034    public default boolean isAsync()
035    {
036        return true;
037    }
038    
039    /**
040     * Get the list of user email to notify by their language for a given activity
041     * @param activity the activity
042     * @return the list of user email to notify
043     */
044    public Map<String, List<String>> getUsersToNotifyByLanguage(Activity activity);
045    
046    /**
047     * Get the mail subject from the activity
048     * @param activity the activity
049     * @param language The language to use, can be null
050     * @return the mail subject
051     */
052    public String getMailSubject(Activity activity, String language);
053    
054    /**
055     * Get the mail body as html from the activity
056     * @param activity the activity
057     * @param language The language to use, can be null
058     * @return the mail body as html. Can be null.
059     */
060    public String getMailHtmlBody(Activity activity, String language);
061    
062    /**
063     * Get the mail body to text format from the activity
064     * @param activity the activity
065     * @param language The language to use, can be null
066     * @return the mail body to text format. Can be null.
067     */
068    public String getMailTextBody(Activity activity, String language);
069}