// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
namespace Microsoft.Teams.Cards;
///
/// Utility class for creating submit data with action-based routing.
///
/// Extends the generated with a convenience constructor
/// that accepts an action identifier for handler routing.
///
///
///
/// new ExecuteAction { Data = new Union<string, SubmitActionData>(new SubmitData("save_profile", new() { ["entity_id"] = "12345" })) }
///
///
public class SubmitData : SubmitActionData
{
private const string ReservedKeyword = "action";
public SubmitData(string action, IDictionary? extraData = null)
{
if (extraData != null)
{
foreach (var kvp in extraData)
{
NonSchemaProperties[kvp.Key] = kvp.Value;
}
}
NonSchemaProperties[ReservedKeyword] = action;
}
}