/**
 * ProductInfo – product detail block (primitive)
 *
 * Title, description, price, optional variant selector and CTA. Minimal layout;
 * override with className/style. For use on individual product page.
 *
 * When options/variants/selections/onSelectionChange are provided and
 * renderVariantSelector is NOT provided, renders the built-in VariantSelector.
 * renderVariantSelector still takes priority as an override.
 */
import React from "react";
import { clsx } from "clsx";
import { PriceDisplay } from "../primitives/PriceDisplay";
import { BadgeList } from "../primitives/BadgeList";
import { VariantSelector } from "../primitives/VariantSelector";
export function ProductInfo({ title, description, price, currency = "$", comparePrice, brand, available, badges, options, variants, selectedVariant: _selectedVariant, selections, onSelectionChange, renderVariantSelector, renderCTA, className, style, }) {
    const priceNum = price != null
        ? typeof price === "number"
            ? price
            : parseFloat(String(price))
        : null;
    const comparePriceNum = comparePrice != null
        ? typeof comparePrice === "number"
            ? comparePrice
            : parseFloat(String(comparePrice))
        : null;
    const showBuiltInVariantSelector = !renderVariantSelector &&
        options &&
        options.length > 0 &&
        variants &&
        selections &&
        onSelectionChange;
    return (React.createElement("div", { className: clsx("seekora-product-info", className), style: style },
        badges && badges.length > 0 && (React.createElement(BadgeList, { badges: badges, position: "inline" })),
        brand && React.createElement("span", { className: "seekora-product-info-brand" }, brand),
        React.createElement("h1", { className: "seekora-product-info-title" }, title),
        priceNum != null && !Number.isNaN(priceNum) && (React.createElement("div", { className: "seekora-product-info-price" },
            React.createElement(PriceDisplay, { price: priceNum, comparePrice: comparePriceNum ?? undefined, currency: currency }))),
        available != null && (React.createElement("span", { className: "seekora-product-info-availability", "data-available": String(available) }, available ? "In Stock" : "Out of Stock")),
        description ? (React.createElement("p", { className: "seekora-product-info-description" }, description)) : null,
        renderVariantSelector ? renderVariantSelector() : null,
        showBuiltInVariantSelector && (React.createElement(VariantSelector, { options: options, variants: variants, selections: selections, onSelectionChange: onSelectionChange, showAvailability: true })),
        renderCTA?.()));
}
