using System.Collections.Generic; namespace Elsa.Client.Models { public class ActivityDefinitionProperty { public static ActivityDefinitionProperty Literal(string name, string expression) => new(name, CreateSingleExpression("Literal", expression), null); public static ActivityDefinitionProperty Liquid(string name, string expression) => new(name, CreateSingleExpression("Liquid", expression), "Liquid"); public static ActivityDefinitionProperty JavaScript(string name, string expression) => new(name, CreateSingleExpression("JavaScript", expression), "JavaScript"); private static IDictionary CreateSingleExpression(string syntax, string expression) => new Dictionary { [syntax] = expression }; public ActivityDefinitionProperty() { } public ActivityDefinitionProperty(string name, IDictionary expressions, string? syntax) { Name = name; Expressions = expressions; Syntax = syntax; } /// /// The name of the property. /// public string Name { get; set; } = default!; /// /// The configured syntax to use when selecting the expression to evaluate. /// /// /// If no value is specified (i.e. null or empty), then an attempt will be made to select for the "Literal" syntax expression. /// public string? Syntax { get; set; } /// /// Contains an expression for each supported syntax. /// public IDictionary Expressions { get; set; } = new Dictionary(); } }