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;
019
020import org.ametys.plugins.repository.activities.Activity;
021import org.ametys.plugins.repository.activities.ActivityType;
022import org.ametys.runtime.plugin.component.Supporter;
023
024/**
025 * Implementation to notify activity
026 */
027public interface ActivityNotifier extends Supporter<ActivityType>
028{
029    /**
030     * <code>true</code> if the notifier is asynchronous
031     * @return <code>true</code> if the notifier is asynchronous
032     */
033    public default boolean isAsync()
034    {
035        return true;
036    }
037    
038    /**
039     * Get the list of user email to notify for a given activity
040     * @param activity the activity
041     * @return the list of user email to notify
042     */
043    public List<String> getUsersEmailToNotify(Activity activity);
044    
045    /**
046     * Get the mail subject from the activity
047     * @param activity the activity
048     * @return the mail subject
049     */
050    public String getMailSubject(Activity activity);
051    
052    /**
053     * Get the mail body as html from the activity
054     * @param activity the activity
055     * @return the mail body as html. Can be null.
056     */
057    public String getMailHtmlBody(Activity activity);
058    
059    /**
060     * Get the mail body to text format from the activity
061     * @param activity the activity
062     * @return the mail body to text format. Can be null.
063     */
064    public String getMailTextBody(Activity activity);
065}