import type { ChatPageContext } from '../../context'
import { h } from 'vue'
import { DimSdkRenameSessionDialog } from '../../../../ui/components/RenameSessionDialog'

export function renderRenameOverlay(ctx: ChatPageContext) {
  if (!ctx.showRenameSession.value) return []

  return [
    h(DimSdkRenameSessionDialog, {
      key: 'rename-session',
      modelValue: ctx.showRenameSession.value,
      'onUpdate:modelValue': (v: boolean) => (ctx.showRenameSession.value = v),
      w: ctx.renameSessionW.value,
      h: ctx.renameSessionH.value,
      initialValue: ctx.renameSessionInitialValue.value,
      onSubmit: (title: string) => ctx.applyRenameSession(title),
      onCancel: () => ctx.cancelRenameSession(),
    }),
  ]
}
