// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
namespace Microsoft.Teams.Cards;
///
/// Convenience class for creating the data payload to open a dialog
/// from an Action.Submit.
///
/// Abstracts away the msteams: { type: "task/fetch" } protocol detail
/// and sets a reserved dialog_id field for handler routing.
///
///
///
/// new SubmitAction { Data = new Union<string, SubmitActionData>(new OpenDialogData("simple_form")) }
///
///
public class OpenDialogData : SubmitActionData
{
private const string ReservedKeyword = "dialog_id";
public OpenDialogData(string dialogId, IDictionary? extraData = null)
{
Msteams = new TaskFetchSubmitActionData();
if (extraData != null)
{
foreach (var kvp in extraData)
{
NonSchemaProperties[kvp.Key] = kvp.Value;
}
}
NonSchemaProperties[ReservedKeyword] = dialogId;
}
}