import { Module } from "@intuitionrobotics/ts-common";
import { FirestoreTransaction } from "@intuitionrobotics/firebase/backend";
import { type DB_Account, type DB_Session, FrontType, type PostAssertBody, type Request_CreateAccount, type Request_LoginAccount, type Request_UpsertAccount, type Response_Auth, type Response_Validation, type UI_Account, type UI_Session } from "./_imports.js";
import { ApiResponse, type ExpressRequest, HeaderKey, type QueryRequestInfo } from "@intuitionrobotics/thunderstorm/backend";
export declare const Header_SessionId: HeaderKey;
type Config = {
    projectId: string;
    sessionTTLms: {
        web: number;
        app: number;
        jwt: number;
    };
    jwtSecretKey: string;
};
export declare const Collection_Sessions = "user-account--sessions";
export declare const Collection_Accounts = "user-account--accounts";
export interface OnNewUserRegistered {
    __onNewUserRegistered(account: UI_Account): void;
}
export interface OnUserLogin {
    __onUserLogin(account: UI_Account): void;
}
export declare class AccountsModule_Class extends Module<Config> implements QueryRequestInfo {
    constructor();
    __queryRequestInfo(request: ExpressRequest): Promise<{
        key: string;
        data: any;
    }>;
    private _sessions?;
    private _accounts?;
    private get sessions();
    private get accounts();
    getUser(_email: string): Promise<UI_Account | undefined>;
    getUsers(_emails: string[]): Promise<UI_Account[]>;
    listUsers(): Promise<UI_Account[]>;
    listSessions(): Promise<DB_Session[]>;
    getSession(_email: string): Promise<DB_Account | undefined>;
    querySessions(_email: string): Promise<UI_Session[] | undefined>;
    create(request: Request_CreateAccount, response: ApiResponse): Promise<Response_Auth>;
    upsert(request: Request_UpsertAccount): Promise<UI_Account>;
    addNewAccount(email: string, password?: string, password_check?: string): Promise<UI_Account>;
    changePassword(userEmail: string, newPassword: string, _transaction?: FirestoreTransaction): Promise<DB_Account>;
    createAccount(request: Request_CreateAccount): Promise<DB_Account>;
    private createImpl;
    logout(sessionId: string): Promise<void>;
    logoutAccount(accountId: string): Promise<void>;
    login(request: Request_LoginAccount, response: ApiResponse): Promise<Response_Auth>;
    private loginValidate;
    loginSAML(__email: string): Promise<Response_Auth>;
    private createSAML;
    private isAuthRequest;
    private verifyAccount;
    validateAuthenticationHeader(request: ExpressRequest, scopes: string[], response?: ApiResponse): Promise<Response_Validation>;
    setJWTinResp(response: ApiResponse, jwt: string): void;
    generateJWT(account: UI_Account, sessionId: string): string;
    validateSession: (request: ExpressRequest, scopes: string[], response?: ApiResponse) => Promise<Response_Validation>;
    validateSessionId(sessionId: string): Promise<UI_Account>;
    private getUserEmailFromSession;
    private getUserEmailFromUserId;
    private TTLExpired;
    private getAccountFromParams;
    upsertSession(p: string | UI_Account, frontType?: FrontType): Promise<Response_Auth>;
    private getSessionFromAccount;
    assertApi(body: PostAssertBody, response: ApiResponse): Promise<void>;
}
export declare const AccountModule: AccountsModule_Class;
export {};
//# sourceMappingURL=AccountModule.d.ts.map