/// <summary>
        /// Returns an attachment based on the state and information of the ticket.
        /// </summary>
        /// <param name="cardElementMapping">Represents Adaptive card item element {Id, display name} mapping.</param>
        /// <param name="ticketDetail"> ticket values entered by user.</param>
        /// <param name="applicationBasePath">Represents the Application base URI.</param>
        /// <param name="localizer">The current cultures' string localizer.</param>
        /// <returns>Returns the attachment that will be sent in a message.</returns>
        public Attachment GetTicketDetailsForSMEChatCard(Dictionary <string, string> cardElementMapping, TicketDetail ticketDetail, string applicationBasePath, IStringLocalizer <Strings> localizer)
        {
            ticketDetail       = ticketDetail ?? throw new ArgumentNullException(nameof(ticketDetail));
            cardElementMapping = cardElementMapping ?? throw new ArgumentNullException(nameof(cardElementMapping));

            Dictionary <string, string> ticketAdditionalDetail = JsonConvert.DeserializeObject <Dictionary <string, string> >(ticketDetail.AdditionalProperties);
            var dynamicElements        = new List <AdaptiveElement>();
            var ticketAdditionalFields = new List <AdaptiveElement>();

            foreach (KeyValuePair <string, string> ticketField in ticketAdditionalDetail)
            {
                string key = ticketField.Key;

                // Issue occured on text block name needs to be fetched from card templates
                // here IssueOccurredOn is the id of text block
                if (ticketField.Key.Equals(CardConstants.IssueOccurredOnId, StringComparison.OrdinalIgnoreCase))
                {
                    key = localizer.GetString("FirstObservedText");
                }

                ticketAdditionalFields.Add(CardHelper.GetAdaptiveCardColumnSet(cardElementMapping.ContainsKey(key) ? cardElementMapping[key] : key, ticketField.Value));
            }

            dynamicElements.AddRange(new List <AdaptiveElement>
            {
                new AdaptiveColumnSet
                {
                    Columns = new List <AdaptiveColumn>
                    {
                        new AdaptiveColumn
                        {
                            Width = "12",
                            Items = new List <AdaptiveElement>
                            {
                                new AdaptiveTextBlock
                                {
                                    Text   = localizer.GetString("RequestDetailsText"),
                                    Weight = AdaptiveTextWeight.Bolder,
                                    Size   = AdaptiveTextSize.Large,
                                },
                            },
                        },
                        new AdaptiveColumn
                        {
                            Width = "3",
                            Items = new List <AdaptiveElement>
                            {
                                new AdaptiveImage
                                {
                                    Url       = new Uri(string.Format(CultureInfo.InvariantCulture, "{0}/Artifacts/Urgent.png", applicationBasePath?.Trim('/'))),
                                    Size      = AdaptiveImageSize.Large,
                                    AltText   = localizer.GetString("UrgentText"),
                                    IsVisible = ticketDetail.RequestType == Constants.UrgentString,
                                },
                            },
                        },
                    },
                },
                new AdaptiveTextBlock()
                {
                    Text    = localizer.GetString("SmeRequestDetailText", this.ticket.RequesterName),
                    Spacing = AdaptiveSpacing.None,
                },
                CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("RequestNumberText"), $"#{ticketDetail.RowKey}"),
                CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("RequestTypeText"), ticketDetail.RequestType),
                CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("RequestStatusText"), $"{(TicketState)ticketDetail.TicketStatus}"),
                CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("TitleDisplayText"), ticketDetail.Title),
            });
            dynamicElements.AddRange(ticketAdditionalFields);
            dynamicElements.Add(CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("DescriptionText"), ticketDetail.Description));

            AdaptiveCard getTicketDetailsForSMEChatCard = new AdaptiveCard(Constants.AdaptiveCardVersion)
            {
                Body    = dynamicElements,
                Actions = this.BuildActions(localizer),
            };

            return(new Attachment
            {
                ContentType = AdaptiveCard.ContentType,
                Content = getTicketDetailsForSMEChatCard,
            });
        }
        /// <summary>
        /// Card to show ticket details in 1:1 chat with bot after submitting request details.
        /// </summary>
        /// <param name="cardElementMapping">Represents Adaptive card item element {Id, display name} mapping.</param>
        /// <param name="ticketDetail">New ticket values entered by user.</param>
        /// <param name="localizer">The current cultures' string localizer.</param>
        /// <param name="isEdited">flag that sets when card is edited.</param>
        /// <returns>An attachment with ticket details.</returns>
        public static Attachment GetTicketDetailsForPersonalChatCard(Dictionary <string, string> cardElementMapping, TicketDetail ticketDetail, IStringLocalizer <Strings> localizer, bool isEdited = false)
        {
            ticketDetail       = ticketDetail ?? throw new ArgumentNullException(nameof(ticketDetail));
            cardElementMapping = cardElementMapping ?? throw new ArgumentNullException(nameof(cardElementMapping));

            Dictionary <string, string> ticketAdditionalDetail = JsonConvert.DeserializeObject <Dictionary <string, string> >(ticketDetail.AdditionalProperties);
            var dynamicElements        = new List <AdaptiveElement>();
            var ticketAdditionalFields = new List <AdaptiveElement>();

            foreach (KeyValuePair <string, string> ticketField in ticketAdditionalDetail)
            {
                string key = ticketField.Key;
                if (ticketField.Key.Equals(CardConstants.IssueOccurredOnId, StringComparison.OrdinalIgnoreCase))
                {
                    key = localizer.GetString("FirstObservedText");
                }

                ticketAdditionalFields.Add(CardHelper.GetAdaptiveCardColumnSet(cardElementMapping.ContainsKey(key) ? cardElementMapping[key] : key, ticketField.Value));
            }

            dynamicElements.AddRange(new List <AdaptiveElement>
            {
                new AdaptiveTextBlock
                {
                    Text   = isEdited == true ? localizer.GetString("RequestUpdatedText") : localizer.GetString("RequestSubmittedText"),
                    Weight = AdaptiveTextWeight.Bolder,
                    Size   = AdaptiveTextSize.Large,
                },
                new AdaptiveTextBlock()
                {
                    Text    = localizer.GetString("RequestSubmittedContent"),
                    Wrap    = true,
                    Spacing = AdaptiveSpacing.None,
                },
                CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("RequestNumberText"), $"#{ticketDetail.RowKey}"),
                CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("RequestTypeText"), ticketDetail.RequestType),
                CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("TitleDisplayText"), ticketDetail.Title),
            });
            dynamicElements.AddRange(ticketAdditionalFields);
            dynamicElements.Add(CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("DescriptionText"), ticketDetail.Description));

            AdaptiveCard ticketDetailsPersonalChatCard = new AdaptiveCard(Constants.AdaptiveCardVersion)
            {
                Body    = dynamicElements,
                Actions = new List <AdaptiveAction>
                {
                    new AdaptiveSubmitAction
                    {
                        Title = localizer.GetString("EditTicketActionText"),
                        Data  = new AdaptiveCardAction
                        {
                            MsteamsCardAction = new CardAction
                            {
                                Type = Constants.FetchActionType,
                            },
                            Command      = Constants.EditRequestAction,
                            PostedValues = ticketDetail.TicketId,
                        },
                    },
                    new AdaptiveShowCardAction()
                    {
                        Title = localizer.GetString("WithdrawRequestActionText"),
                        Card  = WithdrawCard.ConfirmationCard(ticketDetail.TicketId, localizer),
                    },
                    new AdaptiveSubmitAction
                    {
                        Title = localizer.GetString("NewRequestButtonText"),
                        Data  = new AdaptiveCardAction
                        {
                            MsteamsCardAction = new CardAction
                            {
                                Type = Constants.MessageBackActionType,
                                Text = localizer.GetString("NewRequestButtonText"),
                            },
                        },
                    },
                },
            };

            return(new Attachment
            {
                ContentType = AdaptiveCard.ContentType,
                Content = ticketDetailsPersonalChatCard,
            });
        }
        /// <summary>
        /// Returns an attachment based on the state and information of the ticket.
        /// </summary>
        /// <param name="ticketDetail"> ticket values entered by user.</param>
        /// <param name="applicationBasePath">Represents the Application base URI.</param>
        /// <param name="localizer">The current cultures' string localizer.</param>
        /// <returns>Returns the attachment that will be sent in a message.</returns>
        public Attachment GetTicketDetailsForSMEChatCard(TicketDetail ticketDetail, string applicationBasePath, IStringLocalizer <Strings> localizer)
        {
            ticketDetail = ticketDetail ?? throw new ArgumentNullException(nameof(ticketDetail));

            Dictionary <string, string> ticketAdditionalDetail = JsonConvert.DeserializeObject <Dictionary <string, string> >(ticketDetail.AdditionalProperties);
            var dynamicElements        = new List <AdaptiveElement>();
            var ticketAdditionalFields = new List <AdaptiveElement>();

            foreach (KeyValuePair <string, string> item in ticketAdditionalDetail)
            {
                ticketAdditionalFields.Add(CardHelper.GetAdaptiveCardColumnSet(item.Key, item.Value));
            }

            dynamicElements.AddRange(new List <AdaptiveElement>
            {
                new AdaptiveColumnSet
                {
                    Columns = new List <AdaptiveColumn>
                    {
                        new AdaptiveColumn
                        {
                            Width = "12",
                            Items = new List <AdaptiveElement>
                            {
                                new AdaptiveTextBlock
                                {
                                    Text   = localizer.GetString("RequestDetailsText"),
                                    Weight = AdaptiveTextWeight.Bolder,
                                    Size   = AdaptiveTextSize.Large,
                                },
                            },
                        },
                        new AdaptiveColumn
                        {
                            Width = "3",
                            Items = new List <AdaptiveElement>
                            {
                                new AdaptiveImage
                                {
                                    Url       = new Uri(string.Format(CultureInfo.InvariantCulture, "{0}/images/Urgent.png", applicationBasePath?.Trim('/'))),
                                    Size      = AdaptiveImageSize.Large,
                                    AltText   = localizer.GetString("UrgentText"),
                                    IsVisible = ticketDetail.RequestType == Constants.UrgentString,
                                },
                            },
                        },
                    },
                },
                new AdaptiveTextBlock()
                {
                    Text    = localizer.GetString("SmeRequestDetailText", this.ticket.RequesterName),
                    Spacing = AdaptiveSpacing.None,
                },
                CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("RequestNumberText"), $"#{ticketDetail.RowKey}"),
                CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("RequestTypeText"), ticketDetail.RequestType),
                CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("RequestStatusText"), $"{(TicketState)ticketDetail.TicketStatus}"),
                CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("TitleDisplayText"), ticketDetail.Title),
            });
            dynamicElements.AddRange(ticketAdditionalFields);
            dynamicElements.Add(CardHelper.GetAdaptiveCardColumnSet(localizer.GetString("DescriptionText"), ticketDetail.Description));

            AdaptiveCard getTicketDetailsForSMEChatCard = new AdaptiveCard(Constants.AdaptiveCardVersion)
            {
                Body    = dynamicElements,
                Actions = this.BuildActions(localizer),
            };

            return(new Attachment
            {
                ContentType = AdaptiveCard.ContentType,
                Content = getTicketDetailsForSMEChatCard,
            });
        }