'use client'

import { useCustomQuery } from '@/hooks/api'
import { IBaseResponse } from '@/@core/types/api'
import { IProduct } from '@/types/data/simpleProduct/product.interface'
import { request } from '@/utils'

export const useGetProduct = (productId?: string) => {
  return useCustomQuery<IBaseResponse<IProduct>>(
    ['product', productId],
    () => request({ url: `/products/${productId}` }),
    { enabled: !!productId }
  )
}
