using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.DTO.Report; using GB5Shared.FastEndPoint; using TMSBLL.Reports.NominationApprovalSlaRegister; using TMSDAL.DTO.Reports; using static GB5Shared.GB5Constant.Constant; namespace TMSSL.EndPoints.Reports { public class GetNominationApprovalSLARegister : BaseReportEndpoint { private readonly INominationApprovalSlaRegisterBLL _bll; public GetNominationApprovalSLARegister(INominationApprovalSlaRegisterBLL bll) { _bll = bll; } public override void Configure() { Post("/TMSReports/GetNominationApprovalSLARegister"); AllowAnonymous(); } public record GetNominationApprovalSLARegisterParameter( [property: FromHeader] string Login, [property: FromBody] ReportCallingDTO ReportCallingDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult, [property: QueryParam] int MenuId ); protected override IAsyncEnumerable ExecuteReportAsync( GetNominationApprovalSLARegisterParameter req, LoginDTO login, CancellationToken ct) => _bll.GetNominationApprovalSlaRegisterStream( req.FirstNumber, req.MaxResult, req.ReportCallingDTO?.CriteriaDTO, req.MenuId, login, ct); protected override async Task> ExecutePagedAsync( GetNominationApprovalSLARegisterParameter req, LoginDTO login, CancellationToken ct) { var result = await _bll.GetNominationApprovalSlaRegister( req.FirstNumber, req.MaxResult, req.ReportCallingDTO?.CriteriaDTO, req.MenuId, login, ct).ConfigureAwait(false); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, login); } } }