"use client";
import { useStigmer } from "../hooks";
import { useFetch } from "../internal/useFetch";
/**
 * Data hook that fetches a single Organization 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.
 * Call `refetch()` to re-query after mutating the organization through
 * a separate hook or API call.
 *
 * Returns the full proto {@link Organization} resource so consumers
 * have access to metadata (name, slug), spec (description, logo),
 * and status without additional calls.
 *
 * @example
 * ```tsx
 * const { organization, isLoading, error } = useOrganization("org-id-123");
 * ```
 */
export function useOrganization(id) {
    const stigmer = useStigmer();
    const { data: organization, isLoading, isRefetching, error, refetch } = useFetch(id ? () => stigmer.organization.get(id) : null, [id, stigmer], null);
    return { organization, isLoading, isRefetching, error, refetch };
}
//# sourceMappingURL=useOrganization.js.map