'use client';

/** Audio block — thin chat wrapper around `AudioPlayer`. */

import { LazyPlayer } from '../../../../media/AudioPlayer/lazy';
import type { AudioBlock } from '../../../types/block';
import type { BlockRendererProps } from './types';

export default function AudioBlockRenderer({ block, ctx }: BlockRendererProps<AudioBlock>) {
  const variant = block.variant ?? (ctx.appearance === 'compact' ? 'compact' : 'default');
  // `audio` is a "bare" block (no clipping card) because the player renders
  // a scrub-time tooltip ABOVE the bar that a clip would crop. So the player
  // owns its frame — aligned to the shared 2xl radius + soft shadow.
  // `!`-utilities win over PlayerShell's template-string `rounded-lg`
  // regardless of stylesheet order.
  return (
    <LazyPlayer
      src={block.src}
      title={block.title}
      artist={block.artist}
      cover={block.cover}
      variant={variant}
      className="!rounded-2xl shadow-sm"
    />
  );
}
