using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.DTO.Report; using GB5Shared.FastEndPoint; using RecruitmentBLL.Reports; using RecruitmentDAL.DTO.Reports; using static GB5Shared.GB5Constant.Constant; namespace RecruitmentSL.EndPoints.RecruitmentReports { // HR/executive recruitment analytics rollup (Phase 5 of the Recruitment build-out plan — see // /Users/venkatv/.claude/plans/can-you-check-the-precious-sunbeam.md). Org-wide, no recruiter // grouping: requisitions by RequisitionType/RequisitionStatus, planned headcount vs. actual // hires in the period, and average cost-per-hire (a v1 proxy — see // HrRecruitmentAnalyticsReportBLL's doc comment). public class GetHrRecruitmentAnalyticsReport : BaseReportEndpoint { private readonly IHrRecruitmentAnalyticsReportBLL _bll; public GetHrRecruitmentAnalyticsReport(IHrRecruitmentAnalyticsReportBLL bll) { _bll = bll; } public override void Configure() { Post("/RecruitmentReports/GetHrRecruitmentAnalyticsReport"); // Roles() throws 500 here — no host in this repo configures AddAuthentication (see // GetJobRequisition.cs's identical documented gap). AllowAnonymous matches every other // endpoint in this SL module today. AllowAnonymous(); } public record GetHrRecruitmentAnalyticsReportParameter( [property: FromHeader] string Login, [property: FromBody] ReportCallingDTO ReportCallingDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult ); protected override IAsyncEnumerable ExecuteReportAsync( GetHrRecruitmentAnalyticsReportParameter req, LoginDTO login, CancellationToken ct) => _bll.GetHrRecruitmentAnalyticsStream( req.FirstNumber, req.MaxResult, req.ReportCallingDTO?.CriteriaDTO, login, ct); protected override async Task> ExecutePagedAsync( GetHrRecruitmentAnalyticsReportParameter req, LoginDTO login, CancellationToken ct) { var result = await _bll.GetHrRecruitmentAnalytics( req.FirstNumber, req.MaxResult, req.ReportCallingDTO?.CriteriaDTO, login, ct).ConfigureAwait(false); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, login); } } }