using BizProcessBLL.Interfaces; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace BizProcessSL.Endpoints { public class GetProcessVariantMetrics : BaseEndpoint> { private readonly IBizProcessBLL _BizProcessBLL; public GetProcessVariantMetrics(IBizProcessBLL BizProcessBLL) => _BizProcessBLL = BizProcessBLL; public override void Configure() { Get("/BizProcess/GetProcessVariantMetrics"); AllowAnonymous(); } public record Parameters( [property: FromHeader] string Login, [property: QueryParam] int BizProcessVariantId, // Phase 10b — optional. When supplied, Efficiency-category metrics get a real // single-instance cycle-time actual off that document's traced chain (see BLL // comment). Omitted (-1) preserves the original targets-only behavior. [property: QueryParam] int PivotAllocationId = -1 ); protected override string? GetCacheKey(Parameters req, LoginDTO login) => null; // NOT_REQUIRED — computed/live-derived values protected override async Task> ExecuteAsync( Parameters req, LoginDTO login, CancellationToken ct) { try { var data = await _BizProcessBLL.GetProcessVariantMetrics(req.BizProcessVariantId, req.PivotAllocationId, login, ct); return await GB5Shared.ResponseStandard.Response .CreateSuccessResponse(data, CacheKeyLevel.NOT_REQUIRED, login); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response .CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, login, ex.Message, 500); } } } }