import { ComponentType } from 'react';
import { DehydratedState } from 'react-query/hydration';
import { IdTokenClaims, UserinfoResponse } from 'openid-client';

interface ClientAuthAuthenticated {
    isAuthenticated: true;
    credentials: {
        audience?: string;
        claims: IdTokenClaims;
        scope: string[];
        user: UserinfoResponse;
        idToken: string;
        accessToken: string;
    };
    loginUrl: string;
    logoutUrl: string;
}
interface ClientAuthUnauthenticated {
    isAuthenticated: false;
    error?: unknown;
    loginUrl: string;
    logoutUrl: string;
}
declare type ClientAuth = ClientAuthAuthenticated | ClientAuthUnauthenticated;

/// <reference lib="dom" />

interface LazyComponent {
    chunk: string;
    lazyImport: string;
}
declare interface SourceFile {
    path: string;
    text: string;
    lines: string[];
    error?: Error;
}
declare interface Location {
    file: string;
    line?: number;
    column?: number;
}
declare interface Entry extends Location {
    beforeParse: string;
    callee: string;
    index: boolean;
    native: boolean;
    calleeShort: string;
    fileRelative: string;
    fileShort: string;
    fileName: string;
    thirdParty: boolean;
    hide?: boolean;
    sourceLine?: string;
    sourceFile?: SourceFile;
    error?: Error;
}
interface BootstrapOptions {
    auth: ClientAuth;
    automaticReload?: boolean;
    enableTailwind?: boolean;
    errStack?: Entry[];
    lazyComponents: LazyComponent[];
    publicUrl: string;
    reactQueryState: DehydratedState;
}
declare function hydrateNostalgie(App: ComponentType, options: BootstrapOptions): Promise<void>;

export { BootstrapOptions, hydrateNostalgie };
