import { queryOptions } from "@tanstack/react-query";
import { jsonQuery } from "../apiAdapter";

export interface BankAccount {
  id: number;
  account_name: string;
  bank_name: string;
  account_number: string;
  iban: string;
  bic: string;
  currency: string;
  is_default: boolean;
}

export const bankAccountsOptions = () =>
  queryOptions({
    queryKey: ["bank-accounts"],
    queryFn: () => jsonQuery<BankAccount[]>("/api/admin/bank-accounts"),
    staleTime: 2 * 60_000,
  });

export const supplierListOptions = () =>
  queryOptions({
    queryKey: ["suppliers"],
    queryFn: () =>
      jsonQuery<string[]>("/api/admin/received-invoices/suppliers"),
    staleTime: 2 * 60_000,
  });
