using EntitlementBLL.Onboarding; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace EntitlementSL.Endpoints.Onboarding; // Genuinely public/anonymous — lets a QuickStart Step 4 visitor poll their own trial's // provisioning progress after SelfProvisionTrial returns. Requires the Email originally // submitted alongside ProvisioningJobId (see IClientOnboardingOrchestratorBLL's own doc comment) // since ProvisioningJobId alone is a sequential, guessable integer — no [MenuRights] gate, this // is meant to be reachable by the exact same unauthenticated visitor who just signed up. Read-only, // no rate limit needed (unlike SelfProvisionTrial, this can't create/mutate anything). public class GetTrialProvisioningStatus : BaseEndpoint> { private readonly IClientOnboardingOrchestratorBLL _Orchestrator; public GetTrialProvisioningStatus(IClientOnboardingOrchestratorBLL orchestrator) => _Orchestrator = orchestrator; public override void Configure() { Get("/Onboarding/GetTrialProvisioningStatus"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: QueryParam] int ProvisioningJobId, [property: QueryParam] string Email ); protected override string? GetCacheKey(Params req, LoginDTO loginDTO) => null; protected override async Task> ExecuteAsync(Params req, LoginDTO loginDTO, CancellationToken ct) { var result = await _Orchestrator.GetTrialProvisioningStatusAsync(req.ProvisioningJobId, req.Email, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.NOT_REQUIRED, loginDTO); } }