import { api } from '@/core/services/api'
import type { BanksApiResponse } from '../types/bank.types'

export async function listActiveBanks(): Promise<BanksApiResponse> {
  const { data } = await api.get<BanksApiResponse>('/v1/banks/active')

  if (!data.success) {
    throw new Error(data.message ?? 'Gagal memuatkan senarai bank.')
  }

  return data
}
