"use client"

import * as React from "react"
import { type Table } from "@tanstack/react-table"
import { Users} from "lucide-react"

import { Button } from "@/components/ui/button"
import { PartnersBiddingListItem } from '../detail/service'

interface PartnersBiddingToolbarActionsProps {
  table: Table<PartnersBiddingListItem>
  setRowAction?: (action: { type: string; row: { original: PartnersBiddingListItem } }) => void
}

export function PartnersBiddingToolbarActions({ 
  table,
  setRowAction 
}: PartnersBiddingToolbarActionsProps) {
  // 선택된 행 가져오기 (단일 선택)
  const selectedRows = table.getFilteredSelectedRowModel().rows
  const selectedBidding = selectedRows.length === 1 ? selectedRows[0].original : null

  const handleSpecificationMeetingClick = () => {
    if (selectedBidding && setRowAction) {
      setRowAction({ 
        type: 'specification_meeting', 
        row: { original: selectedBidding } 
      })
    }
  }

  return (
    <div className="flex items-center gap-2">
      <Button
        variant="outline"
        size="sm"
        onClick={handleSpecificationMeetingClick}
        className="flex items-center gap-2"
      >
        <Users className="w-4 h-4" />
        사양설명회 참석여부
      </Button>
    </div>
  )
}