using FastEndpoints;

namespace Modules.ERP.Items.Search;

public sealed class Endpoint(SearchItemsHandler handler) : Endpoint<SearchItemsRequest, SearchItemsResponse>
{
    public override void Configure()
    {
        Get("/api/erp/items");
        Permissions("erp.item.read");
    }

    public override async Task HandleAsync(SearchItemsRequest req, CancellationToken ct)
        => await Send.OkAsync(await handler.HandleAsync(req, ct), ct);
}
