/** Built-in field mapping presets matching the canonical shape of each
 *  e-commerce platform's product document, as returned by go-backend's
 *  search API (`/api/v1/search` → `data.results[].document.*`).
 *  SCRUM-268 — eliminates the per-merchant fieldMapping boilerplate.
 */
export const FIELD_MAPPING_PRESETS = {
    /** Shopify product shape (Storefront API aligned via connector v2). */
    shopify: {
        title: "document.title",
        description: "document.descriptionHtml",
        image: "document.featuredImage.url",
        price: "document.priceRange.minVariantPrice.amount",
        url: "document.handle",
        id: "id",
    },
    /** WooCommerce REST API product shape. */
    woocommerce: {
        title: "document.name",
        description: "document.short_description",
        image: "document.images[0].src",
        price: "document.price",
        url: "document.slug",
        id: "id",
    },
    /** Generic / Seekora-legacy (productName / image / mrp / url at document root). */
    seekora_legacy: {
        title: "document.productName",
        description: "document.brandDesc",
        image: "document.image",
        price: "document.mrp",
        url: "document.url",
        id: "id",
    },
};
export function resolveFieldMapping(preset) {
    if (!preset)
        return FIELD_MAPPING_PRESETS.shopify; // default sensibly
    if (typeof preset === "string") {
        return FIELD_MAPPING_PRESETS[preset] ?? FIELD_MAPPING_PRESETS.shopify;
    }
    return preset;
}
