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