"use client";

import { useQuery } from "@tanstack/react-query";
import { useTenantId } from "@/hooks/useTenantId";
import { paymentApi } from "@/modules/payment/services/payment-api";

export function usePaymentCapabilities() {
  const { tenantId } = useTenantId();
  return useQuery({
    queryKey: ["payment", tenantId, "capabilities"],
    queryFn: () => paymentApi.capabilities(tenantId!),
    enabled: !!tenantId,
    staleTime: 60_000,
  });
}

export function usePaymentHealth() {
  return useQuery({
    queryKey: ["payment", "health"],
    queryFn: () => paymentApi.health(),
  });
}

export function usePaymentMetrics() {
  const { tenantId } = useTenantId();
  return useQuery({
    queryKey: ["payment", tenantId, "metrics"],
    queryFn: () => paymentApi.metrics(tenantId ?? undefined),
    staleTime: 30_000,
  });
}
