import { L as AthenaGatewayHookConfig, N as AthenaGatewayHookResult } from './types-BnzoaNRC.js';
export { O as AthenaDeletePayload, P as AthenaFetchPayload, f as AthenaGatewayCallOptions, r as AthenaGatewayErrorCode, g as AthenaGatewayErrorDetails, Q as AthenaGatewayResponse, V as AthenaInsertPayload, s as AthenaJsonArray, h as AthenaJsonObject, t as AthenaJsonPrimitive, A as AthenaJsonValue, i as AthenaRpcCallOptions, u as AthenaRpcFilter, v as AthenaRpcFilterOperator, w as AthenaRpcOrder, x as AthenaRpcPayload, W as AthenaUpdatePayload } from './types-BnzoaNRC.js';
import { a7 as AthenaAuthFetchCompatibleInput, d as AthenaAuthCallOptions, y as AthenaAuthSessionResponse, i as AthenaAuthErrorDetails, v as AthenaAuthResult } from './model-form-CVOtC8jq.js';
export { O as AthenaGatewayError, Z as ModelFormAdapter, _ as ModelFormDefaults, $ as ModelFormNullishMode, a0 as ModelFormValues, a1 as ToModelFormDefaultsOptions, a2 as ToModelPayloadOptions, a3 as createModelFormAdapter, a4 as isAthenaGatewayError, a5 as toModelFormDefaults, a6 as toModelPayload } from './model-form-CVOtC8jq.js';
import * as react from 'react';
import { ReactNode } from 'react';

declare function useAthenaGateway(config?: AthenaGatewayHookConfig): AthenaGatewayHookResult;

type QueryStatus = 'idle' | 'loading' | 'success' | 'error';
type AthenaCacheMode = 'none' | 'memory';
type QueryKey = readonly unknown[] | string;
interface AthenaQueryError {
    message: string;
    status?: number;
    code?: string;
    details?: unknown;
    raw?: unknown;
}
type AthenaRetryDelay = number | ((attempt: number) => number);
type AthenaRetryCount = number | false;
interface AthenaResponseLike<T> {
    data?: T | null;
    error?: unknown;
    status?: number;
    raw?: unknown;
}
interface AthenaQueryRequestLog {
    requestId: number;
    queryKey: QueryKey;
    queryKeyToken: string;
    attempt: number;
    startedAt: number;
    endedAt?: number;
}
interface AthenaMutationRequestLog<TVariables = unknown> {
    requestId: number;
    mutationKey?: QueryKey;
    mutationKeyToken?: string;
    attempt: number;
    startedAt: number;
    endedAt?: number;
    variables?: TVariables;
}
interface AthenaQueryResult<TData = unknown> {
    data: TData | undefined;
    error: AthenaQueryError | null;
    status: number;
    raw: unknown;
}
interface AthenaMutationResultData<TData = unknown> {
    data: TData | undefined;
    error: AthenaQueryError | null;
    status: number;
    raw: unknown;
}
interface AthenaQueryState<TData = unknown> {
    status: QueryStatus;
    isFetching: boolean;
    data: TData | undefined;
    error: AthenaQueryError | null;
    lastRequest?: AthenaQueryRequestLog;
    lastResponse?: unknown;
    updatedAt?: number;
}
interface AthenaMutationState<TVariables = unknown, TData = unknown> {
    status: QueryStatus;
    data: TData | undefined;
    error: AthenaQueryError | null;
    isLoading: boolean;
    lastVariables?: TVariables;
    lastRequest?: AthenaMutationRequestLog<TVariables>;
    lastResponse?: unknown;
    updatedAt?: number;
}
interface UseQueryOptions<TQueryFnData, TData = TQueryFnData> {
    queryKey: QueryKey;
    queryFn: () => Promise<TQueryFnData>;
    enabled?: boolean;
    initialData?: TData;
    refetchOnMount?: boolean;
    refetchOnWindowFocus?: boolean;
    refetchOnReconnect?: boolean;
    retry?: AthenaRetryCount;
    retryDelay?: AthenaRetryDelay;
    select?: (data: TQueryFnData) => TData;
    onSuccess?: (data: TData) => void;
    onError?: (error: AthenaQueryError) => void;
    onSettled?: (data: TData | undefined, error: AthenaQueryError | null) => void;
}
interface UseQueryResult<TData> {
    data: TData | undefined;
    error: AthenaQueryError | null;
    isLoading: boolean;
    isFetching: boolean;
    isSuccess: boolean;
    isError: boolean;
    status: QueryStatus;
    refetch: () => Promise<AthenaQueryResult<TData>>;
    reset: () => void;
    lastResponse?: unknown;
    lastRequest?: AthenaQueryRequestLog;
}
interface UseMutationOptions<TVariables, TMutationFnData, TData = TMutationFnData> {
    mutationFn: (variables: TVariables) => Promise<TMutationFnData>;
    mutationKey?: QueryKey;
    onMutate?: (variables: TVariables) => void | Promise<void>;
    onSuccess?: (data: TData, variables: TVariables) => void;
    onError?: (error: AthenaQueryError, variables: TVariables) => void;
    onSettled?: (data: TData | undefined, error: AthenaQueryError | null, variables: TVariables) => void;
    select?: (data: TMutationFnData) => TData;
    retry?: AthenaRetryCount;
    retryDelay?: AthenaRetryDelay;
}
interface UseMutationResult<TVariables, TData> {
    mutate: (variables: TVariables) => void;
    mutateAsync: (variables: TVariables) => Promise<TData>;
    data: TData | undefined;
    error: AthenaQueryError | null;
    isIdle: boolean;
    isLoading: boolean;
    isSuccess: boolean;
    isError: boolean;
    status: QueryStatus;
    reset: () => void;
    lastResponse?: unknown;
    lastVariables?: TVariables;
    lastRequest?: AthenaMutationRequestLog<TVariables>;
}
interface AthenaCachePolicy {
    mode?: AthenaCacheMode;
    staleTime?: number;
    gcTime?: number;
}
interface AthenaQueryDefaults {
    retry?: AthenaRetryCount;
    retryDelay?: AthenaRetryDelay;
    refetchOnMount?: boolean;
    refetchOnWindowFocus?: boolean;
    refetchOnReconnect?: boolean;
}
interface AthenaMutationDefaults {
    retry?: AthenaRetryCount;
    retryDelay?: AthenaRetryDelay;
}
interface AthenaQueryClientConfig {
    cache?: AthenaCachePolicy;
    defaultQueryOptions?: AthenaQueryDefaults;
    defaultMutationOptions?: AthenaMutationDefaults;
}
type AthenaRuntimeEventType = 'query_updated' | 'query_reset' | 'query_gc' | 'mutation_updated' | 'mutation_reset';
interface AthenaRuntimeBaseEvent {
    type: AthenaRuntimeEventType;
    timestamp: number;
}
interface AthenaQueryEvent extends AthenaRuntimeBaseEvent {
    type: 'query_updated' | 'query_reset' | 'query_gc';
    key: string;
    state: AthenaQueryState<unknown>;
}
interface AthenaMutationEvent extends AthenaRuntimeBaseEvent {
    type: 'mutation_updated' | 'mutation_reset';
    key: string;
    state: AthenaMutationState<unknown, unknown>;
}
type AthenaRuntimeEvent = AthenaQueryEvent | AthenaMutationEvent;
interface AthenaStateAdapter {
    onQueryUpdated?: (event: AthenaQueryEvent) => void;
    onMutationUpdated?: (event: AthenaMutationEvent) => void;
    onEvent?: (event: AthenaRuntimeEvent) => void;
}
type AthenaUnsubscribe = () => void;

type ExecuteQueryInput<TQueryFnData, TData> = {
    queryKey: QueryKey;
    queryKeyToken: string;
    queryFn: () => Promise<TQueryFnData>;
    select?: (data: TQueryFnData) => TData;
    retry?: number | false;
    retryDelay?: number | ((attempt: number) => number);
    dedupe?: boolean;
    force?: boolean;
};
type ExecuteMutationInput<TVariables, TMutationFnData, TData> = {
    mutationKey?: QueryKey;
    mutationKeyToken: string;
    variables: TVariables;
    mutationFn: (variables: TVariables) => Promise<TMutationFnData>;
    select?: (data: TMutationFnData) => TData;
    retry?: number | false;
    retryDelay?: number | ((attempt: number) => number);
};
declare class AthenaQueryClient {
    private readonly queryEntries;
    private readonly mutationEntries;
    private readonly inflightQueries;
    private readonly eventSubscribers;
    private readonly adapters;
    private requestCounter;
    readonly config: AthenaQueryClientConfig;
    readonly defaultQueryOptions: AthenaQueryDefaults;
    readonly defaultMutationOptions: AthenaMutationDefaults;
    constructor(config?: AthenaQueryClientConfig);
    getQueryKeyToken(queryKey: QueryKey): string;
    getMutationKeyToken(mutationKey?: QueryKey): string;
    getQueryState<TData = unknown>(key: string): AthenaQueryState<TData>;
    getMutationState<TVariables = unknown, TData = unknown>(key: string): AthenaMutationState<TVariables, TData>;
    subscribeQuery(key: string, listener: () => void): AthenaUnsubscribe;
    subscribeMutation(key: string, listener: () => void): AthenaUnsubscribe;
    subscribeEvents(listener: (event: AthenaRuntimeEvent) => void): AthenaUnsubscribe;
    attachAdapter(adapter: AthenaStateAdapter): AthenaUnsubscribe;
    resetQuery(queryKey: QueryKey): void;
    resetMutation(mutationKey?: QueryKey): void;
    executeQuery<TQueryFnData, TData = TQueryFnData>(input: ExecuteQueryInput<TQueryFnData, TData>): Promise<AthenaQueryResult<TData>>;
    executeMutation<TVariables, TMutationFnData, TData = TMutationFnData>(input: ExecuteMutationInput<TVariables, TMutationFnData, TData>): Promise<AthenaMutationResultData<TData>>;
    private ensureQueryEntry;
    private ensureMutationEntry;
    private scheduleQueryGc;
    private scheduleMutationGc;
    private setQueryState;
    private setMutationState;
    private emitEvent;
}
declare function createAthenaQueryClient(config?: AthenaQueryClientConfig): AthenaQueryClient;
declare function attachStateAdapter(client: AthenaQueryClient, adapter: AthenaStateAdapter): AthenaUnsubscribe;

interface AthenaQueryClientProviderProps {
    client?: AthenaQueryClient;
    config?: AthenaQueryClientConfig;
    children: ReactNode;
}
declare function AthenaQueryClientProvider(props: AthenaQueryClientProviderProps): react.FunctionComponentElement<react.ProviderProps<AthenaQueryClient | null>>;
declare function useAthenaQueryClient(): AthenaQueryClient;

declare function useQuery<TQueryFnData, TData = TQueryFnData>(options: UseQueryOptions<TQueryFnData, TData>): UseQueryResult<TData>;

declare function useMutation<TVariables, TMutationFnData, TData = TMutationFnData>(options: UseMutationOptions<TVariables, TMutationFnData, TData>): UseMutationResult<TVariables, TData>;

interface UseSessionOptions {
    enabled?: boolean;
    refetchOnMount?: boolean;
    fetchInput?: AthenaAuthFetchCompatibleInput;
    callOptions?: AthenaAuthCallOptions;
}
interface UseSessionResult<TSessionData extends AthenaAuthSessionResponse = AthenaAuthSessionResponse> {
    data: TSessionData | null;
    error: AthenaAuthErrorDetails | null;
    isPending: boolean;
    isRefetching: boolean;
    refetch: () => Promise<TSessionData | null>;
}
type SessionGetter<TSessionData extends AthenaAuthSessionResponse> = (input?: AthenaAuthFetchCompatibleInput, options?: AthenaAuthCallOptions) => Promise<AthenaAuthResult<TSessionData>>;
type UseSessionAuthClient<TSessionData extends AthenaAuthSessionResponse = AthenaAuthSessionResponse> = {
    getSession: SessionGetter<TSessionData>;
} | {
    auth: {
        getSession: SessionGetter<TSessionData>;
    };
};
type InferSessionData<TClient> = TClient extends {
    getSession: (...args: unknown[]) => Promise<AthenaAuthResult<infer TSessionData>>;
} ? TSessionData extends AthenaAuthSessionResponse ? TSessionData : AthenaAuthSessionResponse : TClient extends {
    auth: {
        getSession: (...args: unknown[]) => Promise<AthenaAuthResult<infer TSessionData>>;
    };
} ? TSessionData extends AthenaAuthSessionResponse ? TSessionData : AthenaAuthSessionResponse : AthenaAuthSessionResponse;
/**
 * Better Auth style session hook parity for Athena auth clients.
 */
declare function useSession<TClient extends UseSessionAuthClient>(authClient: TClient, options?: UseSessionOptions): UseSessionResult<InferSessionData<TClient>>;

export { type AthenaCacheMode, type AthenaCachePolicy, AthenaGatewayHookConfig, AthenaGatewayHookResult, type AthenaMutationDefaults, type AthenaMutationEvent, type AthenaMutationRequestLog, type AthenaMutationResultData, type AthenaMutationState, AthenaQueryClient, type AthenaQueryClientConfig, AthenaQueryClientProvider, type AthenaQueryDefaults, type AthenaQueryError, type AthenaQueryEvent, type AthenaQueryRequestLog, type AthenaQueryResult, type AthenaQueryState, type AthenaResponseLike, type AthenaRetryCount, type AthenaRetryDelay, type AthenaRuntimeBaseEvent, type AthenaRuntimeEvent, type AthenaRuntimeEventType, type AthenaStateAdapter, type AthenaUnsubscribe, type QueryKey, type QueryStatus, type UseMutationOptions, type UseMutationResult, type UseQueryOptions, type UseQueryResult, type UseSessionOptions, type UseSessionResult, attachStateAdapter, createAthenaQueryClient, useAthenaGateway, useAthenaQueryClient, useMutation, useQuery, useSession };
