import { cn } from '@/lib/utils'
import { Checkbox } from '@/components/ui/checkbox'
import { Table, Grid3X3, Rows3 } from 'lucide-react'
import { useTranslation } from 'react-i18next'
import type { TableDetectionConfig } from '@/types/apiV2'
interface TableDetectionSelectorProps {
value: TableDetectionConfig
onChange: (config: TableDetectionConfig) => void
disabled?: boolean
className?: string
}
interface DetectionOption {
key: keyof TableDetectionConfig
icon: React.ReactNode
labelKey: string
descKey: string
}
const DETECTION_OPTIONS: DetectionOption[] = [
{
key: 'enable_wired_table',
icon: ,
labelKey: 'processing.tableDetection.wired',
descKey: 'processing.tableDetection.wiredDesc',
},
{
key: 'enable_wireless_table',
icon: ,
labelKey: 'processing.tableDetection.wireless',
descKey: 'processing.tableDetection.wirelessDesc',
},
{
key: 'enable_region_detection',
icon:
,
labelKey: 'processing.tableDetection.region',
descKey: 'processing.tableDetection.regionDesc',
},
]
export default function TableDetectionSelector({
value,
onChange,
disabled = false,
className,
}: TableDetectionSelectorProps) {
const { t } = useTranslation()
const handleOptionChange = (key: keyof TableDetectionConfig, checked: boolean) => {
onChange({
...value,
[key]: checked,
})
}
return (
{/* Header */}
{t('processing.tableDetection.title')}
{/* Detection Options */}
{DETECTION_OPTIONS.map((option) => {
const isChecked = value[option.key]
return (
)
})}
{/* Info Note */}
{t('processing.tableDetection.note')}
)
}