using FastEndpoints;using Kbx.Shared.Telemetry;
namespace Kbx.Modules.Common.UxTelemetry.Metrics;
public sealed record Request(DateOnly From,DateOnly To,string? ScreenId);
public sealed class Endpoint(KbxUxMetricsQuery query):Endpoint<Request,KbxUxMetricsResponse>
{
    public override void Configure(){Get("/api/kbx/ux/metrics");Permissions("common.ux.read");}
    public override async Task HandleAsync(Request req,CancellationToken ct)
    {
        var tenantId=Kbx.Shared.Runtime.RuntimeIdentity.TenantId(User);
        await Send.OkAsync(await query.ExecuteAsync(tenantId,req.From,req.To,req.ScreenId,ct),ct);
    }
}
