'use client'

import { Edit2, MoreVertical, FileText } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { useLanguage } from '@/lib/i18n'
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu'
import { Notebook } from '@/lib/types'

interface NotebookActionsProps {
  notebook: Notebook
  onEdit: () => void
  onDelete: () => void
  onSummary?: () => void
}

export function NotebookActions({ notebook, onEdit, onDelete, onSummary }: NotebookActionsProps) {
  const { t } = useLanguage()
  return (
    <DropdownMenu>
      <DropdownMenuTrigger asChild>
        <Button
          variant="ghost"
          size="sm"
          className="h-8 w-8 p-0"
        >
          <MoreVertical className="h-3 w-3" />
        </Button>
      </DropdownMenuTrigger>
      <DropdownMenuContent align="end">
        {onSummary && (
          <DropdownMenuItem onClick={onSummary}>
            <FileText className="h-4 w-4 mr-2" />
            {t('notebook.summary')}
          </DropdownMenuItem>
        )}
        <DropdownMenuItem onClick={onEdit}>
          <Edit2 className="h-4 w-4 mr-2" />
          {t('notebook.edit')}
        </DropdownMenuItem>
        <DropdownMenuItem
          onClick={onDelete}
          className="text-red-600"
        >
          {t('notebook.delete')}
        </DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  )
}
