using System.Linq; using System.Net; using FrameworkDAL.DTO.EIPConversation; namespace FrameworkSL.Endpoints.Action { /// Shared HTML rendering for GET /Action/Conversation and POST /// /Action/ConversationReply — both endpoints render the same /// EIPExecutionResultDTO shape, just entered from a fresh token vs. a reply. internal static class DirectActionConversationHtml { public static string Page(string token, EIPExecutionResultDTO result) { var message = WebUtility.HtmlEncode(result.ResponseMessage ?? string.Empty); var body = result.IsCompleted ? $@"

✓ {message}

" : BuildPrompt(token, message, result); return $@" Action
{body}

GoodBooks ERP — Action Confirmation

"; } private static string BuildPrompt(string token, string message, EIPExecutionResultDTO result) { var tokenField = $@""; if (result.Buttons?.Count > 0) { var buttons = string.Join("\n", result.Buttons.Select(b => $@"
{tokenField}
")); return $@"

{message}

{buttons}"; } return $@"

{message}

{tokenField}
"; } } }