'use client'

import { useState } from 'react'
import { Button } from '@/components/ui/button'
import { ProductDialog, type ProductDialogProduct } from '@/components/dialogs/product-dialog'

interface Props {
  product: ProductDialogProduct
}

export function EditProductButton({ product }: Props) {
  const [open, setOpen] = useState(false)

  return (
    <>
      <Button variant="outline" size="sm" onClick={() => setOpen(true)}>
        Bewerken
      </Button>
      <ProductDialog
        mode="edit"
        open={open}
        onOpenChange={setOpen}
        product={product}
      />
    </>
  )
}
