'use client'

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

export const PENDING_TRANSACTIONS_QUERY_KEY = 'pending-transactions'

export const useGetPendingTransactions = () => {
  return useCustomQuery<IBaseResponse<ITransactionSummary[]>>(
    [PENDING_TRANSACTIONS_QUERY_KEY],
    () =>
      request({
        url: '/transactions/pending'
      }),
    {
      staleTime: 1000 * 30
    }
  )
}
