// Copyright Epic Games, Inc. All Rights Reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
namespace EpicGames.Slack.Elements
{
///
/// An element which lets users easily select a date from a calendar style UI.
///
public abstract class SelectMenuElement : Element
{
///
/// An identifier for this action. You can use this when you receive an interaction payload to identify the source of the action.
/// Should be unique among all other action_ids in the containing block. Maximum length for this field is 255 characters.
///
[JsonPropertyName("action_id")]
public string ActionId { get; set; }
///
/// Constructor
///
protected SelectMenuElement(string type, string actionId) : base(type)
{
ActionId = actionId;
}
}
///
/// This is the simplest form of select menu, with a static list of options passed in when defining the element.
///
public class StaticSelectMenuElement : SelectMenuElement
{
///
/// A plain_text only text object that defines the placeholder text shown on the menu. Maximum length for the text in this field is 150 characters.
///
[JsonPropertyName("placeholder")]
public PlainTextObject Placeholder { get; set; }
///
/// An array of option objects. A maximum of 10 options are allowed.
///
[JsonPropertyName("options")]
[SuppressMessage("Usage", "CA2227:Collection properties should be read only")]
public List? Options { get; set; }
///
/// An array of option objects. A maximum of 10 options are allowed.
///
[JsonPropertyName("option_groups")]
[SuppressMessage("Usage", "CA2227:Collection properties should be read only")]
public List? OptionGroups { get; set; }
///
/// An array of option objects that exactly matches one or more of the options within options. These options will be selected when the checkbox group initially loads.
///
[JsonPropertyName("initial_option")]
public SlackOption? InitialOption { get; }
///
/// A confirm object that defines an optional confirmation dialog that appears after clicking one of the checkboxes in this element.
///
[JsonPropertyName("confirm")]
public SlackConfirm? Confirm { get; set; }
///
/// Indicates whether the element will be set to auto focus within the view object. Only one element can be set to true. Defaults to false.
///
[JsonPropertyName("focus_on_load")]
public bool FocusOnLoad { get; set; }
///
/// Construct a new Button action element.
///
public StaticSelectMenuElement(string actionId, PlainTextObject placeholder, List options)
: base("static_select", actionId)
{
Placeholder = placeholder;
Options = new List(options);
}
///
/// Construct a new Button action element.
///
public StaticSelectMenuElement(string actionId, PlainTextObject placeholder, List optionGroups)
: base("static_select", actionId)
{
Placeholder = placeholder;
OptionGroups = new List(optionGroups);
}
}
}