import { useMemo } from 'react'
import type { FieldType } from '@/components/Filters'
import { useGetCategories } from '../hooks/useProductData'

export const useProductFiltersFields = (): FieldType[] => {

    const { data } = useGetCategories()

    return useMemo(() => [
        {
            type: 'input',
            name: 'search',
            placeholder: 'جستجو',
        },
        {
            type: 'select',
            name: 'categoryId',
            placeholder: 'انتخاب',
            options: data?.data?.map((item) => {
                return {
                    label: item.title,
                    value: item.id
                }
            }) || []
        },
    ], [data?.data])
}
