/**
 * 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: { display: 'flex', flexDirection: 'column', gap: 12, ...style } },
        badges && badges.length > 0 && (React.createElement(BadgeList, { badges: badges, position: "inline" })),
        brand && (React.createElement("span", { className: "seekora-product-info-brand", style: { fontSize: '0.8125rem', color: 'var(--seekora-text-secondary)', textTransform: 'uppercase', letterSpacing: '0.02em' } }, brand)),
        React.createElement("h1", { className: "seekora-product-info-title", style: { fontSize: '1.25rem', fontWeight: 600, margin: 0 } }, title),
        (priceNum != null && !Number.isNaN(priceNum)) && (React.createElement("div", { className: "seekora-product-info-price" },
            React.createElement(PriceDisplay, { price: priceNum, comparePrice: comparePriceNum ?? undefined, currency: currency, style: { fontSize: '1.125rem' } }))),
        available != null && (React.createElement("span", { className: "seekora-product-info-availability", style: {
                fontSize: '0.875rem',
                color: available ? 'var(--seekora-success, #22c55e)' : 'var(--seekora-error, #ef4444)',
            } }, available ? 'In Stock' : 'Out of Stock')),
        description ? (React.createElement("p", { className: "seekora-product-info-description", style: { fontSize: '0.875rem', color: 'var(--seekora-text-secondary)', margin: 0, lineHeight: 1.5 } }, description)) : null,
        renderVariantSelector ? renderVariantSelector() : null,
        showBuiltInVariantSelector && (React.createElement(VariantSelector, { options: options, variants: variants, selections: selections, onSelectionChange: onSelectionChange, showAvailability: true })),
        renderCTA?.()));
}
