'use client';

import { BaseSessionLiveWrapper } from '@/components/collaboration/BaseSessionLiveWrapper';
import {
  shareGifMoodSession,
  shareGifMoodSessionToTeam,
  removeGifMoodShare,
} from '@/actions/gif-mood';
import type { TeamWithMembers, Share } from '@/lib/share-utils';

interface GifMoodLiveWrapperProps {
  sessionId: string;
  sessionTitle: string;
  currentUserId: string;
  shares: Share[];
  isOwner: boolean;
  canEdit: boolean;
  userTeams?: TeamWithMembers[];
  children: React.ReactNode;
}

export function GifMoodLiveWrapper({
  sessionId,
  sessionTitle,
  currentUserId,
  shares,
  isOwner,
  canEdit,
  userTeams = [],
  children,
}: GifMoodLiveWrapperProps) {
  return (
    <BaseSessionLiveWrapper
      sessionId={sessionId}
      sessionTitle={sessionTitle}
      currentUserId={currentUserId}
      shares={shares}
      isOwner={isOwner}
      canEdit={canEdit}
      userTeams={userTeams}
      config={{
        apiPath: 'gif-mood',
        shareModal: {
          title: 'Partager le GIF Mood Board',
          sessionSubtitle: 'GIF Mood Board',
          helpText: (
            <>
              <strong>Éditeur</strong> : peut ajouter ses GIFs et voir ceux des autres
              <br />
              <strong>Lecteur</strong> : peut uniquement consulter
            </>
          ),
        },
        onShareWithEmail: (email, role) => shareGifMoodSession(sessionId, email, role),
        onShareWithTeam: (teamId, role) => shareGifMoodSessionToTeam(sessionId, teamId, role),
        onRemoveShare: (userId) => removeGifMoodShare(sessionId, userId),
      }}
    >
      {children}
    </BaseSessionLiveWrapper>
  );
}
