"use client";
import { useStigmer } from "../hooks";
import { useFetch } from "../internal/useFetch";
/**
 * Data hook that fetches a single PlatformClient by ID.
 *
 * Pass `null` to skip fetching (stable no-op). When the `id` changes,
 * the previous in-flight request is discarded and a fresh fetch begins.
 *
 * Returns the full proto {@link PlatformClient} resource so consumers
 * have access to metadata, spec (client ID, expiry, JIT config), and
 * status without additional calls.
 *
 * @example
 * ```tsx
 * function PlatformClientDetail({ pcId }: { pcId: string }) {
 *   const { platformClient, isLoading, error } = usePlatformClient(pcId);
 *
 *   if (isLoading) return <Skeleton />;
 *   if (error) return <ErrorMessage error={error} />;
 *   if (!platformClient) return <NotFound />;
 *
 *   return <h1>{platformClient.metadata?.name}</h1>;
 * }
 * ```
 */
export function usePlatformClient(id) {
    const stigmer = useStigmer();
    const { data: platformClient, isLoading, isRefetching, error, refetch } = useFetch(id ? () => stigmer.platformclient.get(id) : null, [id, stigmer], null);
    return { platformClient, isLoading, isRefetching, error, refetch };
}
//# sourceMappingURL=usePlatformClient.js.map