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.plugins.workflow;
017import java.util.ArrayList;
018import java.util.List;
019import java.util.Map;
020
021import org.ametys.runtime.i18n.I18nizableText;
022
023import com.opensymphony.workflow.Condition;
024
025/**
026 * Interface for adding description and arguments to {@link Condition}
027 */
028public interface EnhancedCondition extends Condition
029{
030    /**
031     * Record of the condition argument
032     * @param name label of the argument
033     */
034    public record ConditionArgument(String name) { /*empty*/ }
035    
036    /**
037     * Get the list of accepted arguments for this condition
038     * @return a List of argument names and associated description
039     */
040    public default List<ConditionArgument> getArguments()
041    {
042        return new ArrayList<>();
043    }
044    
045    /**
046     * Get the condition descriptions depending on arguments values
047     * @param argumentsValues a map of the arguments with their values in current workflow
048     * @return a description to display in workflow editor vue
049     */
050    public default I18nizableText getDescription(Map<String, String> argumentsValues)
051    {
052        return null;
053    }
054}