// Copyright Epic Games, Inc. All Rights Reserved. using System.Text.Json.Serialization; using EpicGames.Slack.Elements; namespace EpicGames.Slack.Blocks { /// /// A block that collects information from users - it can hold a plain-text input element, a checkbox element, a radio button element, a select menu element, a multi-select menu element, or a datepicker. /// public class InputBlock : Block { /// /// A label that appears above an input element in the form of a text object that must have type of plain_text. Maximum length for the text in this field is 2000 characters. /// [JsonPropertyName("label"), JsonPropertyOrder(1)] public PlainTextObject Label { get; set; } /// /// A plain-text input element, a checkbox element, a radio button element, a select menu element, a multi-select menu element, or a datepicker. /// [JsonPropertyName("element"), JsonPropertyOrder(2)] public Element Element { get; set; } /// /// A boolean that indicates whether or not the use of elements in this block should dispatch a block_actions payload. Defaults to false. /// [JsonPropertyName("dispatch_action"), JsonPropertyOrder(3)] public bool? DispatchAction { get; set; } /// /// An optional hint that appears below an input element in a lighter grey. It must be a text object with a type of plain_text. Maximum length for the text in this field is 2000 characters. /// [JsonPropertyName("hint"), JsonPropertyOrder(4)] public PlainTextObject? Hint { get; set; } /// /// A boolean that indicates whether the input element may be empty when a user submits the modal. Defaults to false. /// [JsonPropertyName("optional"), JsonPropertyOrder(5)] public bool? Optional { get; set; } /// /// Constructor /// public InputBlock(PlainTextObject label, Element element) : base("input") { Label = label; Element = element; } } /// /// Extension methods for /// public static class InputBlockExtensions { /// /// Add an to the list of blocks /// public static InputBlock AddInput(this ISlackBlockContainer container, PlainTextObject label, Element element) { InputBlock block = new InputBlock(label, element); container.Blocks.Add(block); return block; } } }