'use client';

import { EditableTitle } from './EditableTitle';
import { updateYearReviewSession } from '@/actions/year-review';

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

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

