import { Auth, AuthIdentifier, OAuthProvider, OtpToken, MfaMethod, Session, SessionLog } from './models.interface'; import { AuthStrategy } from '../enums/auth-type.enum'; export interface AuthRepository { create(data: Partial): Promise; findById(id: string): Promise; findByUid(uid: string): Promise; findAllByUid(uid: string): Promise; findAll(): Promise; findByUidAndStrategy(uid: string, strategy: AuthStrategy): Promise; findByUidAndStrategies(uid: string, strategies: AuthStrategy[]): Promise; save(auth: Auth): Promise; update(id: string, data: Partial): Promise; delete(id: string): Promise; deleteByUid(uid: string): Promise; findWithIdentifiers(id: string): Promise; } export interface AuthIdentifierRepository { create(data: Partial): Promise; findByValue(value: string): Promise; findByAuthId(authId: string): Promise; findByUidAndTypes(uid: string, types: string[]): Promise; findWithAuthByValue(value: string): Promise<{ identifier: AuthIdentifier; auth: Auth; } | null>; save(identifier: AuthIdentifier): Promise; markVerifiedByAuthId(authId: string): Promise; } export interface OAuthProviderRepository { create(data: Partial): Promise; findByProviderUserId(provider: string, providerUserId: string): Promise; findWithAuthByProviderUserId(provider: string, providerUserId: string): Promise<{ provider: OAuthProvider; auth: Auth; } | null>; save(provider: OAuthProvider): Promise; update(id: string, data: Partial): Promise; } export interface OtpTokenRepository { create(data: Partial): Promise; findLatestUnused(uid: string): Promise; findLatestUnusedByPurpose(uid: string, purpose: string): Promise; save(token: OtpToken): Promise; deleteByUid(uid: string): Promise; } export interface MfaMethodRepository { create(data: Partial): Promise; findByUidAndType(uid: string, type: string): Promise; findByUidAndEnabled(uid: string): Promise; save(method: MfaMethod): Promise; deleteByUid(uid: string): Promise; } export interface SessionRepository { create(data: Partial): Promise; findById(id: string): Promise; findDeviceSession(uid: string, namespace: string | undefined, deviceFingerprint: string): Promise; findByUid(uid: string): Promise; findByIdWithDetails(id: string, namespace?: string): Promise; save(session: Session): Promise; update(id: string, data: Partial): Promise; delete(id: string): Promise; deleteByUid(uid: string): Promise; transaction(runInTransaction: (repo: SessionRepository) => Promise): Promise; } export interface SessionLogRepository { create(data: Partial): Promise; save(log: SessionLog): Promise; saveMany(logs: SessionLog[]): Promise; findByUidAndNamespace(uid: string, namespace?: string): Promise; }