'use client';

import { BaseSessionLiveWrapper } from '@/components/collaboration/BaseSessionLiveWrapper';
import { shareYearReviewSession, removeYearReviewShare } from '@/actions/year-review';
import type { TeamWithMembers, Share } from '@/lib/share-utils';

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

export function YearReviewLiveWrapper({
  sessionId,
  sessionTitle,
  currentUserId,
  shares,
  isOwner,
  canEdit,
  userTeams = [],
  children,
}: YearReviewLiveWrapperProps) {
  return (
    <BaseSessionLiveWrapper
      sessionId={sessionId}
      sessionTitle={sessionTitle}
      currentUserId={currentUserId}
      shares={shares}
      isOwner={isOwner}
      canEdit={canEdit}
      userTeams={userTeams}
      config={{
        apiPath: 'year-review',
        shareModal: {
          title: 'Partager le bilan',
          sessionSubtitle: 'Bilan annuel',
          helpText: (
            <>
              <strong>Éditeur</strong> : peut modifier les items et leurs catégories
              <br />
              <strong>Lecteur</strong> : peut uniquement consulter
            </>
          ),
        },
        onShareWithEmail: (email, role) => shareYearReviewSession(sessionId, email, role),
        onRemoveShare: (userId) => removeYearReviewShare(sessionId, userId),
      }}
    >
      {children}
    </BaseSessionLiveWrapper>
  );
}
