'use client';

export default function OwnerBadge({
    owner,
    uploader,
    className = '',
}: {
    owner?: { id?: string | number; display_name?: string } | null;
    uploader?: string | null;
    className?: string;
}) {
    const hasOwner = !!owner?.id;
    const label = hasOwner ? 'Owner' : 'Uploader';
    const name = owner?.display_name ?? uploader ?? '—';

    return (
        <span
        className={`inline-flex items-center gap-2 text-xs px-2 py-1 rounded-md border border-border bg-card ${className}`}
        title={hasOwner ? 'Owner' : (uploader ? 'Original uploader' : '')}
        >
        <span className="opacity-70">{label}:</span>
        <span className="font-medium">{name}</span>
        </span>
    );
}
