import { createElement } from 'react';
import { GradialPicture } from './GradialPicture.js';
import { GradialVideoPlayer } from './GradialVideoPlayer.js';
/**
 * Polymorphic media component — renders a GradialAsset as the appropriate
 * HTML element based on $type.
 *
 * - gradial.image → <picture> or <img> via GradialPicture
 * - gradial.video → <video> via GradialVideoPlayer
 */
export function GradialMedia({ asset, className, style, loading = 'lazy', imgProps, videoProps, }) {
    switch (asset.$type) {
        case 'gradial.image':
            return createElement(GradialPicture, {
                image: asset,
                className,
                style,
                loading,
                ...imgProps,
            });
        case 'gradial.video':
            return createElement(GradialVideoPlayer, {
                video: asset,
                className,
                style,
                ...videoProps,
            });
        default:
            return null;
    }
}
