'use client';

import { EditableTitle } from './EditableTitle';
import { updateWeatherSession } from '@/actions/weather';

interface EditableWeatherTitleProps {
  sessionId: string;
  initialTitle: string;
  canEdit: boolean;
}

export function EditableWeatherTitle({
  sessionId,
  initialTitle,
  canEdit,
}: EditableWeatherTitleProps) {
  return (
    <EditableTitle
      sessionId={sessionId}
      initialTitle={initialTitle}
      canEdit={canEdit}
      onUpdate={async (id, title) => {
        const result = await updateWeatherSession(id, { title });
        return result;
      }}
    />
  );
}
