import { Type } from '@nestjs/common';
import { MFAOptions } from './mfa-options.interface';
import { CookieOptions, SessionOptions } from './session-options.interface';
import { BaseAuthProvider } from '../providers/base-auth.provider';
import { DebugLogOptions } from '../services/debug-logger.service';
import { NestAuthUser } from '../../user/entities/user.entity';
import { SessionPayload, JWTTokenPayload } from './token-payload.interface';
import { NestAuthSignupRequestDto } from 'src/lib/auth';
export interface IDefaultTenantOptions {
    name: string;
    slug: string;
    description?: string;
    metadata?: Record<string, any>;
}
export interface IRegistrationCollectProfileField {
    id: string;
    label: string;
    required: boolean;
    type: 'text' | 'email' | 'phone' | 'select' | 'checkbox' | 'password';
    placeholder?: string;
    options?: Array<{
        label: string;
        value: string;
    }>;
}
export interface IUserHooks {
    beforeCreate?: (userData: Partial<NestAuthUser>, input: any) => Promise<Partial<NestAuthUser>> | Partial<NestAuthUser>;
    afterCreate?: (user: NestAuthUser, input: any) => Promise<void> | void;
    serialize?: (user: NestAuthUser) => Partial<NestAuthUser>;
    sensitiveFields?: string[];
}
export interface IAuthHooks {
    transformResponse?: (response: any, user: NestAuthUser, session: SessionPayload) => Promise<any> | any;
}
export interface IRegistrationHooks {
    beforeSignup?: (input: NestAuthSignupRequestDto, context: {
        request: any;
    }) => Promise<any> | any;
    onSignup?: (user: NestAuthUser, input: any, context?: {
        request?: any;
    }) => Promise<NestAuthUser | void> | NestAuthUser | void;
}
export interface ILoginHooks {
    onLogin?: (user: NestAuthUser, input: any, context?: {
        request?: any;
        provider?: any;
    }) => Promise<NestAuthUser | void> | NestAuthUser | void;
}
export interface IPasswordHooks {
    hash?: (password: string) => Promise<string>;
    verify?: (password: string, hash: string) => Promise<boolean>;
    validate?: (password: string) => {
        valid: boolean;
        errors?: string[];
    };
}
export interface IOtpOptions {
    generate?: (length?: number) => string | Promise<string>;
    length?: number;
    format?: 'numeric' | 'alphanumeric';
}
export interface IGuardHooks {
    beforeAuth?: (request: any, payload: JWTTokenPayload) => Promise<void | {
        reject: boolean;
        reason?: string;
    }>;
    afterAuth?: (request: any, user: NestAuthUser, session: SessionPayload) => Promise<void> | void;
}
export interface IAuthorizationHooks {
    resolveRoles?: (user: NestAuthUser) => Promise<string[]>;
    resolvePermissions?: (user: NestAuthUser, roles: string[]) => Promise<string[]>;
}
export interface IAuthAuditEvent {
    type: 'login' | 'logout' | 'signup' | 'password_change' | 'mfa_enable' | 'session_revoke';
    userId?: string;
    ip?: string;
    userAgent?: string;
    success: boolean;
    metadata?: Record<string, any>;
    timestamp: Date;
}
export interface IAuditOptions {
    enabled?: boolean;
    onEvent?: (event: IAuthAuditEvent) => Promise<void> | void;
}
export interface IAuthModuleOptions {
    isGlobal?: boolean;
    appName: string;
    enableAutoRefresh?: boolean;
    accessTokenType?: 'header' | 'cookie';
    cookieOptions?: CookieOptions;
    jwt: {
        secret: string;
        accessTokenExpiresIn?: number | string;
        refreshTokenExpiresIn?: number | string;
        validateToken?: (payload: JWTTokenPayload, session: SessionPayload) => Promise<boolean>;
    };
    google?: {
        clientId: string;
        clientSecret: string;
        redirectUri: string;
    };
    facebook?: {
        appId: string;
        appSecret: string;
        redirectUri: string;
    };
    apple?: {
        clientId: string;
        teamId: string;
        keyId: string;
        privateKey: string;
        privateKeyMethod?: string;
        redirectUri: string;
    };
    github?: {
        clientId: string;
        clientSecret: string;
        redirectUri: string;
    };
    phoneAuth?: {
        enabled: boolean;
    };
    emailAuth?: {
        enabled: boolean;
    };
    registration?: {
        enabled?: boolean;
        requireInvitation?: boolean;
        autoLoginAfterSignup?: boolean;
        collectProfileFields?: Array<IRegistrationCollectProfileField>;
    };
    clientConfig?: {
        factory?: (defaultConfig: any, context: {
            configService: any;
            tenantService: any;
        }) => Promise<any> | any;
    };
    mfa?: MFAOptions;
    session?: SessionOptions;
    customAuthProviders?: BaseAuthProvider[];
    passwordResetOtpExpiresIn?: number | string;
    passwordResetTokenExpiresIn?: number | string;
    defaultTenant?: IDefaultTenantOptions;
    adminConsole?: IAdminConsoleOptions;
    debug?: DebugLogOptions;
    user?: IUserHooks;
    auth?: IAuthHooks;
    registrationHooks?: IRegistrationHooks;
    loginHooks?: ILoginHooks;
    guards?: IGuardHooks;
    password?: IPasswordHooks;
    otp?: IOtpOptions;
    authorization?: IAuthorizationHooks;
    audit?: IAuditOptions;
    errorHandler?: (error: Error, context: 'login' | 'signup' | 'refresh' | 'mfa' | 'password_reset' | 'password_change') => any;
    resolveConfig?: (context: any) => Promise<Partial<IAuthModuleOptions>> | Partial<IAuthModuleOptions>;
}
export interface IAdminConsoleOptions {
    enabled?: boolean;
    basePath?: string;
    secretKey?: string;
    sessionCookieName?: string;
    sessionDuration?: string | number;
    cookie?: CookieOptions;
    allowAdminManagement?: boolean;
}
export interface IAuthModuleAsyncOptions {
    isGlobal?: boolean;
    enableAutoRefresh?: boolean;
    imports?: any[];
    useFactory?: (...args: any[]) => Promise<IAuthModuleOptions> | IAuthModuleOptions;
    inject?: any[];
    useClass?: Type<IAuthModuleOptionsFactory>;
    useExisting?: Type<IAuthModuleOptionsFactory>;
}
export interface IAuthModuleOptionsFactory {
    createAuthModuleOptions(): Promise<IAuthModuleOptions> | IAuthModuleOptions;
}
//# sourceMappingURL=auth-module-options.interface.d.ts.map