/**
* UCP Catalog Discovery
* Facade for catalog search and product retrieval.
* Currently returns structured interfaces; will call Shopify Storefront API later.
*/
import type { CatalogProduct } from '../types.js';
/** Search query parameters for catalog discovery. */
export interface CatalogSearchQuery {
keyword?: string;
category?: string;
price_min?: number; // minor units
price_max?: number; // minor units
available_only?: boolean;
}
/** Search result envelope with pagination metadata. */
export interface CatalogSearchResult {
products: CatalogProduct[];
total_count: number;
has_more: boolean;
cursor?: string;
}
/**
* Search the catalog by keyword, category, price range, and availability.
*
* This is a facade that will eventually delegate to the Shopify Storefront API.
* Currently returns an empty result set with the proper structure.
*
* @param query - Search parameters
* @param _filters - Additional filters (reserved for future use)
* @returns A CatalogSearchResult with matching products
*/
export async function searchCatalog(
query: CatalogSearchQuery,
_filters?: Record<string, unknown>,
): Promise<CatalogSearchResult> {
// Placeholder: In production, this calls Shopify Storefront API via GraphQL.
// The query parameters will be translated to Shopify search syntax:
// keyword → Storefront "query" field
// category → product_type filter
// price_* → variant price range filter
// available_only → available_for_sale filter
void query; // acknowledge usage for linting
return {
products: [],
total_count: 0,
has_more: false,
};
}
/**
* Retrieve a single product by its ID.
*
* This is a facade that will eventually delegate to the Shopify Storefront API.
* Currently returns null to indicate "not found" for any product ID.
*
* @param productId - The product ID to look up
* @returns The CatalogProduct if found, or null
*/
export async function getProduct(productId: string): Promise<CatalogProduct | null> {
// Placeholder: In production, this calls Shopify Storefront API:
// query { product(id: "gid://shopify/Product/{productId}") { ... } }
void productId; // acknowledge usage for linting
return null;
}