'use client'

import { IBaseResponse, CustomUseQueryOptions } from '@/@core/types/api'
import { useCustomQuery } from '@/hooks/api'
import { request } from '@/utils'

export interface ITableDropdownItem {
  id: string
  table_number: string
  capacity?: number
  location?: string | null
  display_name?: string
}

export const TABLES_DROPDOWN_QUERY_KEY = 'tables-dropdown'

export const useGetTablesDropdown = (
  options?: CustomUseQueryOptions<IBaseResponse<ITableDropdownItem[]>>
) => {
  return useCustomQuery<IBaseResponse<ITableDropdownItem[]>>(
    [TABLES_DROPDOWN_QUERY_KEY],
    () =>
      request({
        url: '/tables/dropdown/list'
      }),
    options
  )
}
