using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.DTO.Report; using GB5Shared.FastEndPoint; using RecruitmentBLL.Reports.ApplicationCycleTime; using RecruitmentDAL.DTO.Reports; using static GB5Shared.GB5Constant.Constant; namespace RecruitmentSL.EndPoints.RecruitmentReports { // Phase 5 analytics (see /Users/venkatv/.claude/plans/can-you-check-the-precious-sunbeam.md) — // cycle-time report. Row grain: one row per (Application, SelectionProcessStage) — see // ApplicationCycleTimeDTO's doc comment. public class GetApplicationCycleTime : BaseReportEndpoint { private readonly IApplicationCycleTimeBLL _bll; public GetApplicationCycleTime(IApplicationCycleTimeBLL bll) { _bll = bll; } public override void Configure() { Post("/RecruitmentReports/GetApplicationCycleTime"); AllowAnonymous(); } public record GetApplicationCycleTimeParameter( [property: FromHeader] string Login, [property: FromBody] ReportCallingDTO ReportCallingDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult, [property: QueryParam] int MenuId ); protected override IAsyncEnumerable ExecuteReportAsync( GetApplicationCycleTimeParameter req, LoginDTO login, CancellationToken ct) => _bll.GetApplicationCycleTimeStream( req.FirstNumber, req.MaxResult, req.ReportCallingDTO?.CriteriaDTO, login, ct); protected override async Task> ExecutePagedAsync( GetApplicationCycleTimeParameter req, LoginDTO login, CancellationToken ct) { var result = await _bll.GetApplicationCycleTime( req.FirstNumber, req.MaxResult, req.ReportCallingDTO?.CriteriaDTO, login, ct).ConfigureAwait(false); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, login); } } }