'use client'

import { useCustomQuery } from '@/hooks/api'
import { request } from '@/utils'
import type { IOrderPaymentMethod } from '@/types/data'
import type { IBaseResponse } from '@/@core/types/api'

export const PAYMENT_METHODS_QUERY_KEY = 'payment-methods'

export const useGetPaymentMethods = () => {
  return useCustomQuery<IBaseResponse<IOrderPaymentMethod[]>>(
    [PAYMENT_METHODS_QUERY_KEY],
    () =>
      request({
        url: '/entity/payment-methods',
        withToken: false
      }),
    {
      staleTime: 1000 * 60 * 10
    }
  )
}
