using Newtonsoft.Json; namespace LineMessaging { public interface ILineAction { [JsonProperty("type")] ActionType Type { get; } } public class PostbackAction : ILineAction { [JsonProperty("type")] public ActionType Type => ActionType.Postback; [JsonProperty("label")] public string Label { get; set; } [JsonProperty("data")] public string Data { get; set; } [JsonProperty("displayText")] public string DisplayText { get; set; } [JsonProperty("inputOption")] public string InputOption { get; set; } [JsonProperty("fillInText")] public string FillInText { get; set; } } public class MessageAction : ILineAction { [JsonProperty("type")] public ActionType Type => ActionType.Message; [JsonProperty("label")] public string Label { get; set; } [JsonProperty("text")] public string Text { get; set; } } public class UriAction : ILineAction { [JsonProperty("type")] public ActionType Type => ActionType.Uri; [JsonProperty("label")] public string Label { get; set; } private string _uri; [JsonProperty("uri")] public string Uri { get { return _uri; } set { if (value.IndexOf("?") == -1) { value += "?openExternalBrowser=1"; } else { value += "&openExternalBrowser=1"; } _uri = value; } } } public class DatetimepickerAction : ILineAction { [JsonProperty("type")] public ActionType Type => ActionType.Datetimepicker; [JsonProperty("label")] public string Label { get; set; } [JsonProperty("data")] public string Data { get; set; } [JsonProperty("mode")] public string Mode { get; set; } [JsonProperty("initial")] public string Initial { get; set; } [JsonProperty("max")] public string Max { get; set; } [JsonProperty("min")] public string Min { get; set; } } }