import { type UserRoleEnum } from './roles.js';
/** Invitations are valid for a week by default — a person has to act. */
export declare const INVITE_EXPIRY_MS: number;
export declare const VALID_EXPIRY_DAYS: readonly [7, 14, 30];
export interface InviteConfig {
    siteUrl: string;
    /** Admin mount path; the accept link is `<siteUrl><adminPath>/reset-password`. */
    adminPath?: string;
    invitedByName?: string;
    invitedByUserId?: string;
    siteName?: string;
}
export interface CreateInviteInput {
    email: string;
    role: string;
    message?: string;
    /** Days until expiry; one of {@link VALID_EXPIRY_DAYS}. Defaults to 7. */
    expiresInDays?: number;
}
export interface InviteResult {
    success: boolean;
    error?: string;
    /** Distinguish "already invited" so the UI can offer Resend instead. */
    code?: 'DUPLICATE_USER' | 'PENDING_INVITE' | 'INVALID_EMAIL' | 'INVALID_ROLE' | 'NOT_FOUND';
    /** The accept link. Returned only when email was NOT sent, so an admin can share it. */
    inviteUrl?: string;
    emailed?: boolean;
    invite?: SerializedInvite;
}
export interface SerializedInvite {
    id: string;
    email: string;
    role: UserRoleEnum;
    roleName: string;
    status: string;
    invitedByUserId: string | null;
    expiresAt: string;
    createdAt: string;
    expired: boolean;
}
/**
 * Create an invitation. Provisions a placeholder user, persists a PENDING
 * invite + single-use reset token, and emails the accept link.
 */
export declare function createInvite(db: any, input: CreateInviteInput, config: InviteConfig): Promise<InviteResult>;
export interface ListInvitesParams {
    status?: string;
    search?: string;
}
/**
 * List invites, lazily flipping any past-expiry PENDING rows to EXPIRED so the
 * status is always honest without a background job.
 */
export declare function listInvites(db: any, params?: ListInvitesParams): Promise<SerializedInvite[]>;
/** Flip PENDING invites whose expiry has passed to EXPIRED. Returns the count. */
export declare function expireStaleInvites(db: any): Promise<number>;
/** Resend (or revive an expired) invite: fresh token, reset expiry, re-email. */
export declare function resendInvite(db: any, inviteId: string, config: InviteConfig): Promise<InviteResult>;
/** Cancel an invite and deactivate its placeholder user so the link is dead. */
export declare function cancelInvite(db: any, inviteId: string): Promise<InviteResult>;
/** Change the role on a pending invite (and its placeholder user). */
export declare function updateInviteRole(db: any, inviteId: string, role: string): Promise<InviteResult>;
/** Extend a pending invite's expiry and re-sync its reset token expiry. */
export declare function extendInvite(db: any, inviteId: string, days: number): Promise<InviteResult>;
/**
 * Mark the pending invite for an email as ACCEPTED. Called when a user sets
 * their password through the reset/accept flow. Safe to call for non-invited
 * users — it simply updates zero rows.
 */
export declare function markInviteAcceptedForEmail(db: any, email: string, userId: string): Promise<boolean>;
//# sourceMappingURL=invites.d.ts.map