import { SmrtObject, SmrtObjectOptions } from '@happyvertical/smrt-core'; import { User as UserContract } from '@happyvertical/smrt-types'; import { UserStatus } from '../types/index.js'; /** * Constructor options for {@link User}. */ export interface UserOptions extends SmrtObjectOptions { profileId?: string; email?: string; status?: UserStatus; lastLoginAt?: Date | null; } /** * Validate email format. * @param email - Email address to validate * @returns true if email format is valid */ export declare function isValidEmail(email: string): boolean; /** * Normalize email address (lowercase and trim). * @param email - Email address to normalize * @returns Normalized email */ export declare function normalizeEmail(email: string): string; /** * User represents an authenticated identity in the system. * * Users are linked to Profiles from smrt-profiles via profileId. * A User can have multiple Memberships across different Tenants. * * @example * ```typescript * const user = await users.create({ * profileId: 'profile-uuid', * email: 'user@example.com', * status: UserStatus.ACTIVE * }); * await user.save(); * ``` */ export declare class User extends SmrtObject implements UserContract { /** * Foreign key to smrt-profiles Profile (cross-package) */ profileId: string; /** * User's email address (unique, used for lookup). * * Indexed: `findByEmail()` filters on this raw column directly (#2364, * epic #2382 finding A3). Distinct from `emailKey`'s unique index below — * `emailKey` is a separately normalized column (`normalizeIdentityEmail()`) * that arbitrates cross-connection uniqueness, and its index does not serve * a read path that filters on `email` itself. */ email: string; /** Durable normalized key for cross-connection email uniqueness. */ emailKey: string | null; /** * User account status */ status: UserStatus; /** * Last login timestamp */ lastLoginAt: Date | null; constructor(options?: UserOptions); /** * Validate the user's email format. * @returns true if email is valid */ hasValidEmail(): boolean; /** * Check if user is active */ isActive(): boolean; /** * Check if user is suspended */ isSuspended(): boolean; /** * Check if user is pending verification */ isPending(): boolean; /** * Record a login event */ recordLogin(): void; /** Keep the durable email key derived from the public email field. */ save(): Promise; } //# sourceMappingURL=User.d.ts.map