using System.Threading.Tasks;
namespace CoreConnect.Commerce.Catalog;
public interface ICatalogService
/// Lookup URL path to find matching product or category.
/// <param name="request">The request.</param>
/// <param name="context">The request context.</param>
/// <param name="cancellationToken">A cancellation token which can be used to cancel the operation.</param>
/// <returns>The product or category.</returns>
Task<LookupUrlResponse> LookupUrl(LookupUrlRequest request, IRequestContext context,
CancellationToken cancellationToken = default);
/// Gets the category tree.
/// <param name="context">The request context.</param>
/// <param name="cancellationToken">A cancellation token which can be used to cancel the operation.</param>
/// <returns>The category tree.</returns>
Task<IEnumerable<Category>> GetCategoryTree(IRequestContext context,
CancellationToken cancellationToken = default);
/// Gets the specified category.
/// <param name="request">The request.</param>
/// <param name="context">The request context.</param>
/// <param name="cancellationToken">A cancellation token which can be used to cancel the operation.</param>
/// <returns>The category.</returns>
Task<Category?> GetCategory(GetCategoryRequest request, IRequestContext context,
CancellationToken cancellationToken = default);
/// Performs a product search.
/// <param name="request">The request.</param>
/// <param name="context">The context.</param>
/// <param name="cancellationToken">A cancellation token which can be used to cancel the operation.</param>
/// <returns>The product search results</returns>
Task<SearchProductsResponse> SearchProducts(SearchProductsRequest request, IRequestContext context,
CancellationToken cancellationToken = default);
/// <param name="request"></param>
/// <param name="context"></param>
/// <param name="cancellationToken"></param>
Task<SuggestResponse> FetchSuggestions(FetchSuggestionRequest request, IRequestContext context,
CancellationToken cancellationToken = default);
/// Gets the specified product.
/// <param name="request">The request.</param>
/// <param name="context">The request context.</param>
/// <param name="cancellationToken">A cancellation token which can be used to cancel the operation.</param>
/// <returns>The product.</returns>
Task<Product?> GetProduct(GetProductRequest request, IRequestContext context,
CancellationToken cancellationToken = default);
/// Internal api to list all products and trigger a callback
/// <param name="context">context for the request</param>
/// <param name="callback">Callback</param>
/// <param name="cancellationToken">Token to cancel</param>
Task ListAllProducts(IRequestContext context, Func<Product, Task> callback, CancellationToken cancellationToken = default);
/// Fetches all products.
/// <param name="cancellationToken">The cancellation token.</param>
IAsyncEnumerable<List<Product>> FetchAllProducts(CancellationToken cancellationToken = default);
Task<IEnumerable<Category>> GetCategoryFlatList(IRequestContext context, CancellationToken cancellationToken = default);