'use client'

import { NoteEditorProvider, useNoteEditorContext } from './note-editor-context'
import { NoteEditorFullPage } from './note-editor-full-page'
import { NoteEditorDialog } from './note-editor-dialog'
import { Note } from '@/lib/types'

interface NoteEditorProps {
  note: Note
  readOnly?: boolean
  onClose: () => void
  fullPage?: boolean
}

export function NoteEditor({ note, readOnly, onClose, fullPage = false }: NoteEditorProps) {
  return (
    <NoteEditorProvider note={note} readOnly={readOnly} fullPage={fullPage}>
      {fullPage ? (
        <NoteEditorFullPage onClose={onClose} />
      ) : (
        <NoteEditorDialog onClose={onClose} />
      )}
    </NoteEditorProvider>
  )
}

// Re-export context hook for backwards compatibility
export { useNoteEditorContext } from './note-editor-context'

// Re-export sub-components for advanced usage
export { NoteEditorFullPage } from './note-editor-full-page'
export { NoteEditorDialog } from './note-editor-dialog'
export { NoteEditorProvider } from './note-editor-context'
export { NoteTitleBlock } from './note-title-block'
export { NoteContentArea } from './note-content-area'
export { NoteMetadataSection } from './note-metadata-section'
export { NoteEditorToolbar } from './note-editor-toolbar'