'use client';

import { EditableTitle } from './EditableTitle';
import { updateWeeklyCheckInSession } from '@/actions/weekly-checkin';

interface EditableWeeklyCheckInTitleProps {
  sessionId: string;
  initialTitle: string;
  isOwner: boolean;
}

export function EditableWeeklyCheckInTitle({
  sessionId,
  initialTitle,
  isOwner,
}: EditableWeeklyCheckInTitleProps) {
  return (
    <EditableTitle
      sessionId={sessionId}
      initialTitle={initialTitle}
      isOwner={isOwner}
      onUpdate={async (id, title) => {
        const result = await updateWeeklyCheckInSession(id, { title });
        return result;
      }}
    />
  );
}
