import * as better_auth from 'better-auth';
import { Where, Session, User } from 'better-auth';
import { TransactionChunk, InstantAdminDatabase, InstantSchemaDef } from '@instantdb/admin';
import { InstantReactWebDatabase } from '@instantdb/react';

interface InstantDBAdapterConfig {
    /**
     * Helps you debug issues with the adapter.
     */
    debugLogs?: boolean;
    /**
     * If the table names in the schema are plural.
     */
    usePlural?: boolean;
    /**
     * Hooks to add additional transactions to the create and update methods.
     */
    transactionHooks?: {
        create?: ({ model, data }: {
            model: string;
            data: Record<string, any>;
        }) => Promise<TransactionChunk<any, any>[] | undefined> | Promise<void>;
        update?: ({ model, update, where }: {
            model: string;
            update: Record<string, any>;
            where: Where[];
        }) => Promise<TransactionChunk<any, any>[] | undefined> | Promise<void>;
    };
    db: InstantAdminDatabase<InstantSchemaDef<any, any, any>>;
}
declare function parseWhere(where?: Where[]): Record<string, unknown>;
declare const instantDBAdapter: ({ usePlural, debugLogs, transactionHooks, db }: InstantDBAdapterConfig) => (options: better_auth.BetterAuthOptions) => better_auth.Adapter;

declare function useInstantAuth({ db, sessionData, isPending }: {
    db: InstantReactWebDatabase<InstantSchemaDef<any, any, any>>;
    sessionData?: {
        session: Session;
        user: User;
    } | null;
    isPending: boolean;
}): void;

export { type InstantDBAdapterConfig, instantDBAdapter, parseWhere, useInstantAuth };
