using FastEndpoints;

namespace Modules.OMS.Orders.Search;

public sealed class Endpoint(SearchOrdersHandler handler)
    : Endpoint<SearchOrdersRequest, SearchOrdersResponse>
{
    public override void Configure()
    {
        Get("/api/oms/orders");
        Permissions("oms.order.read");
    }

    public override async Task HandleAsync(SearchOrdersRequest req, CancellationToken ct)
    {
        var response = await handler.HandleAsync(req, ct);
        await Send.OkAsync(response, ct);
    }
}
