import type { Nip95Config } from '@/lib/configStorageTypes'
import { t } from '@/lib/i18n'
import { Nip95ConfigContent } from './Nip95ConfigContent'

export function Nip95ConfigView(params: {
  apis: Nip95Config[]
  loading: boolean
  error: string | null
  editingId: string | null
  newUrl: string
  showAddForm: boolean
  draggedId: string | null
  dragOverId: string | null
  onClearError: () => void
  onToggleAddForm: () => void
  onNewUrlChange: (value: string) => void
  onCancelAdd: () => void
  onAddApi: () => void
  onStartEditing: (id: string) => void
  onStopEditing: () => void
  onUpdateUrl: (id: string, url: string) => void
  onToggleEnabled: (id: string, enabled: boolean) => void
  onRemoveApi: (id: string) => void
  onDragStart: (e: React.DragEvent<HTMLDivElement>, id: string) => void
  onDragOver: (e: React.DragEvent<HTMLDivElement>, id: string) => void
  onDragLeave: () => void
  onDrop: (e: React.DragEvent<HTMLDivElement>, targetId: string) => void
}): React.ReactElement {
  if (params.loading) {
    return (
      <div className="text-center py-8 text-neon-cyan">
        <div>{t('settings.nip95.loading')}</div>
      </div>
    )
  }
  return <Nip95ConfigContent {...params} />
}
