//using FastEndpoints;
//using FrameworkDAL.DTO.EIPConversation;
//using FrameworkDAL.DTO.MessageHub.MessageHubGenerator;
//using GB5Shared.DTO.Framework.Login;
//using GB5Shared.DTO.Framework.ResponseStandard;
//using GB5Shared.FastEndPoint;
//using Microsoft.Extensions.Logging;
//using Microsoft.Extensions.Options;
//using System;
//using System.Threading;
//using System.Threading.Tasks;
//using static GB5Shared.GB5Constant.Constant;
//namespace FrameworkSL.Endpoints.EIPConversation
//{
// ///
// /// GET endpoint for webhook verification (e.g., WhatsApp, Messenger)
// ///
// public class RequestMessageHubConversation
// : BaseEndpoint>
// {
// private readonly ILogger _logger;
// private readonly CelitixSettings _celitix;
// public RequestMessageHubConversation(
// ILogger logger,
// IOptions settings)
// {
// _logger = logger ?? throw new ArgumentNullException(nameof(logger));
// _celitix = settings?.Value?.Celitix ?? new CelitixSettings();
// }
// public override void Configure()
// {
// Get("/api/messagehub/webhook");
// AllowAnonymous();
// }
// #region Request Parameters
// public record VerifyRequest(
// [property: QueryParam] string? hub_mode,
// [property: QueryParam] string? hub_verify_token,
// [property: QueryParam] string? hub_challenge
// );
// #endregion
// protected override async Task> ExecuteAsync(
// VerifyRequest req,
// LoginDTO loginDTO,
// CancellationToken ct)
// {
// try
// {
// _logger.LogInformation("Webhook verification request | Mode={Mode}", req.hub_mode);
// if (!string.IsNullOrEmpty(req.hub_mode) &&
// req.hub_mode.Equals("subscribe", StringComparison.OrdinalIgnoreCase) &&
// !string.IsNullOrEmpty(req.hub_verify_token) &&
// req.hub_verify_token == _celitix.WebhookSecret)
// {
// _logger.LogInformation("Webhook verified successfully");
// return await GB5Shared.ResponseStandard.Response
// .CreateSuccessResponse(
// req.hub_challenge ?? string.Empty,
// CacheKeyLevel.NOT_REQUIRED,
// loginDTO);
// }
// return await GB5Shared.ResponseStandard.Response
// .CreateSuccessResponse("OK", CacheKeyLevel.NOT_REQUIRED, loginDTO);
// }
// catch (Exception ex)
// {
// _logger.LogError(ex, "Webhook verification failed");
// return await GB5Shared.ResponseStandard.Response
// .CreateExceptionError(
// ex,
// CacheKeyLevel.NOT_REQUIRED,
// loginDTO,
// ex.Message,
// 500);
// }
// }
// }
//}