'use client'

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

export const CURRENCIES_QUERY_KEY = 'entity-currencies'

export const useGetCurrencies = () => {
  return useCustomQuery<IBaseResponse<ICurrencyOption[]>>(
    [CURRENCIES_QUERY_KEY],
    () =>
      request({
        url: '/entity/currencies',
        withToken: false
      }),
    {
      staleTime: 1000 * 60 * 10
    }
  )
}
