import { OnExecutePostLogin } from "../../types/Hooks";
export interface EnsureUsernameOptions {
    /**
     * The connection name used for username accounts.
     * @default Strategy.USERNAME_PASSWORD
     */
    connection?: string;
    /**
     * The provider used for username accounts.
     * @default USERNAME_PASSWORD_PROVIDER
     */
    provider?: string;
    /**
     * Maximum number of attempts to find a unique username before giving up.
     * @default 10
     */
    maxRetries?: number;
}
/**
 * Slugify a string into a valid username.
 *
 * - Lowercases and normalizes unicode (NFD + strip diacritics)
 * - Replaces non-alphanumeric characters with hyphens
 * - Collapses consecutive hyphens
 * - Trims leading/trailing hyphens
 * - Returns undefined if the result is empty
 */
export declare function slugify(input: string): string | undefined;
/**
 * Extract candidate usernames from a user's profile fields.
 *
 * Tries the following fields in order:
 * 1. nickname
 * 2. name
 * 3. Local part of email (before @)
 * 4. phone_number
 *
 * Each value is slugified. Duplicates are removed while preserving order.
 */
export declare function extractCandidateUsernames(user: {
    nickname?: string | null;
    name?: string | null;
    email?: string | null;
    phone_number?: string | null;
}): string[];
/**
 * Creates a post-login hook that ensures every user has a username.
 *
 * **Behavior:**
 * - If the user is a username-type account (username-password provider), it verifies
 *   the `username` field is set. If not, it picks one from the profile fields.
 * - If the user logged in via another provider (email, social, SMS), it checks
 *   whether a linked username account already exists. If not, it creates a new
 *   username account and links it to the current user.
 *
 * **Username candidate extraction (in order):**
 * 1. `nickname`
 * 2. `name`
 * 3. Local part of `email` (before `@`)
 * 4. `phone_number`
 *
 * Each candidate is slugified (lowercased, non-alphanum replaced with hyphens).
 * If the slug is taken, numeric suffixes are tried (e.g. `john`, `john2`, `john3`).
 *
 * @example
 * ```typescript
 * import { init, preDefinedHooks } from "authhero";
 *
 * const { app } = init({
 *   dataAdapter,
 *   hooks: {
 *     onExecutePostLogin: preDefinedHooks.ensureUsername(),
 *   },
 * });
 * ```
 *
 * @example Custom connection name
 * ```typescript
 * preDefinedHooks.ensureUsername({
 *   connection: "my-username-connection",
 *   provider: USERNAME_PASSWORD_PROVIDER,
 *   maxRetries: 20,
 * })
 * ```
 */
export declare function ensureUsername(options?: EnsureUsernameOptions): OnExecutePostLogin;
