import { Synnax as Client } from '@synnaxlabs/client';
import { Destructor } from '@synnaxlabs/x';
import { core } from './core';
import { Result } from './result';
import { state } from '../state';
export interface RetrieveParams<Query extends core.Shape, Store extends core.Store> {
    client: Client;
    query: Query;
    store: Store;
}
export interface RetrieveMountListenersParams<Query extends core.Shape, Data extends core.Shape, Store extends core.Store> extends RetrieveParams<Query, Store> {
    onChange: state.Setter<Data | undefined>;
}
export interface CreateRetrieveParams<Query extends core.Shape, Data extends core.Shape, Store extends core.Store> {
    name: string;
    retrieve: (Params: RetrieveParams<Query, Store>) => Promise<Data>;
    mountListeners?: (Params: RetrieveMountListenersParams<Query, Data, Store>) => Destructor | Destructor[];
}
export interface BeforeRetrieveParams<Query extends core.Shape> {
    query: Query;
}
export interface UseObservableBaseRetrieveParams<Query extends core.Shape, Data extends state.State> {
    addStatusOnFailure?: boolean;
    beforeRetrieve?: (Params: BeforeRetrieveParams<Query>) => Data | boolean;
    onChange: (result: state.SetArg<Result<Data>>, query: Query) => void;
    scope?: string;
}
export interface UseRetrieveObservableParams<Query extends core.Shape, Data extends state.State> extends Omit<UseObservableBaseRetrieveParams<Query, Data>, "onChange"> {
    onChange: (result: Result<Data>, query: Query) => void;
}
export interface UseRetrieveObservableReturn<Query extends core.Shape> {
    retrieve: (query: state.SetArg<Query, Partial<Query>>, options?: core.FetchOptions) => void;
    retrieveAsync: (query: state.SetArg<Query, Partial<Query>>, options?: core.FetchOptions) => Promise<void>;
}
export type UseRetrieveStatefulReturn<Query extends core.Shape, Data extends state.State> = Result<Data> & UseRetrieveObservableReturn<Query>;
export interface UseDirectRetrieveParams<Query extends core.Shape, Data extends state.State> extends Pick<UseObservableBaseRetrieveParams<Query, Data>, "scope" | "beforeRetrieve" | "addStatusOnFailure"> {
    query: Query;
}
export type UseDirectRetrieveReturn<Data extends state.State> = Result<Data>;
export interface UseRetrieveEffectParams<Query extends core.Shape, Data extends state.State> {
    scope?: string;
    onChange?: (result: Result<Data>, query: Query) => void;
    query?: Query;
}
export interface UseRetrieve<Query extends core.Shape, Data extends state.State> {
    (params: Query, opts?: Pick<UseDirectRetrieveParams<Query, Data>, "beforeRetrieve" | "addStatusOnFailure">): UseDirectRetrieveReturn<Data>;
}
export interface UseRetrieveEffect<Query extends core.Shape, Data extends state.State> {
    (params: UseRetrieveEffectParams<Query, Data>): void;
}
export interface UseRetrieveStateful<Query extends core.Shape, Data extends state.State> {
    (): UseRetrieveStatefulReturn<Query, Data>;
}
export interface UseRetrieveObservable<Query extends core.Shape, Data extends state.State> {
    (params: UseRetrieveObservableParams<Query, Data>): UseRetrieveObservableReturn<Query>;
}
export interface CreateRetrieveReturn<Query extends core.Shape, Data extends state.State> {
    useRetrieve: UseRetrieve<Query, Data>;
    useRetrieveEffect: UseRetrieveEffect<Query, Data>;
    useRetrieveStateful: UseRetrieveStateful<Query, Data>;
    useRetrieveObservable: UseRetrieveObservable<Query, Data>;
}
export declare const useObservableRetrieve: <Query extends core.Shape, Data extends state.State, ScopedStore extends core.Store>({ onChange, ...restParams }: UseRetrieveObservableParams<Query, Data> & CreateRetrieveParams<Query, Data, ScopedStore>) => UseRetrieveObservableReturn<Query>;
export declare const createRetrieve: <Query extends core.Shape, Data extends state.State, ScopedStore extends core.Store = {}>(createParams: CreateRetrieveParams<Query, Data, ScopedStore>) => CreateRetrieveReturn<Query, Data>;
//# sourceMappingURL=retrieve.d.ts.map