/**
 * RADIUS accounting session
 */
export interface IAccountingSession {
    /** Unique session ID from RADIUS */
    sessionId: string;
    /** Username (often MAC address for MAB) */
    username: string;
    /** MAC address of the device */
    macAddress?: string;
    /** NAS IP address (switch/AP) */
    nasIpAddress: string;
    /** NAS port (physical or virtual) */
    nasPort?: number;
    /** NAS port type */
    nasPortType?: string;
    /** NAS identifier (name) */
    nasIdentifier?: string;
    /** Assigned VLAN */
    vlanId?: number;
    /** Assigned IP address (if any) */
    framedIpAddress?: string;
    /** Called station ID (usually BSSID for wireless) */
    calledStationId?: string;
    /** Calling station ID (usually client MAC) */
    callingStationId?: string;
    /** Session start time */
    startTime: number;
    /** Session end time (0 if active) */
    endTime: number;
    /** Last update time (interim accounting) */
    lastUpdateTime: number;
    /** Session status */
    status: 'active' | 'stopped' | 'terminated';
    /** Termination cause (if stopped) */
    terminateCause?: string;
    /** Input octets (bytes received by NAS from client) */
    inputOctets: number;
    /** Output octets (bytes sent by NAS to client) */
    outputOctets: number;
    /** Input packets */
    inputPackets: number;
    /** Output packets */
    outputPackets: number;
    /** Session duration in seconds */
    sessionTime: number;
    /** Service type */
    serviceType?: string;
}
/**
 * Accounting summary for a time period
 */
export interface IAccountingSummary {
    /** Time period start */
    periodStart: number;
    /** Time period end */
    periodEnd: number;
    /** Total sessions */
    totalSessions: number;
    /** Active sessions */
    activeSessions: number;
    /** Total input bytes */
    totalInputBytes: number;
    /** Total output bytes */
    totalOutputBytes: number;
    /** Total session time (seconds) */
    totalSessionTime: number;
    /** Average session duration (seconds) */
    averageSessionDuration: number;
    /** Unique users/devices */
    uniqueUsers: number;
    /** Sessions by VLAN */
    sessionsByVlan: Record<number, number>;
    /** Top users by traffic */
    topUsersByTraffic: Array<{
        username: string;
        totalBytes: number;
    }>;
}
/**
 * Accounting manager configuration
 */
export interface IAccountingManagerConfig {
    /** Session retention period in days (default: 30) */
    retentionDays?: number;
    /** Enable detailed session logging */
    detailedLogging?: boolean;
    /** Maximum active sessions to track in memory */
    maxActiveSessions?: number;
    /** Stale session timeout in hours — sessions with no update for this long are evicted (default: 24) */
    staleSessionTimeoutHours?: number;
}
/**
 * Manages RADIUS accounting data including:
 * - Session tracking (start/stop/interim)
 * - Data usage tracking (bytes in/out)
 * - Session history and retention
 * - Billing reports and summaries
 */
export declare class AccountingManager {
    private activeSessions;
    private config;
    private staleSessionSweepTimer?;
    private stats;
    constructor(config?: IAccountingManagerConfig);
    /**
     * Initialize the accounting manager
     */
    initialize(): Promise<void>;
    /**
     * Stop the accounting manager and clean up timers
     */
    stop(): void;
    /**
     * Sweep stale active sessions that have not received any update
     * within the configured timeout. These are orphaned sessions where
     * the Stop packet was never received.
     */
    private sweepStaleSessions;
    /**
     * Handle accounting start request
     */
    handleAccountingStart(data: {
        sessionId: string;
        username: string;
        macAddress?: string;
        nasIpAddress: string;
        nasPort?: number;
        nasPortType?: string;
        nasIdentifier?: string;
        vlanId?: number;
        framedIpAddress?: string;
        calledStationId?: string;
        callingStationId?: string;
        serviceType?: string;
    }): Promise<void>;
    /**
     * Handle accounting interim update request
     */
    handleAccountingUpdate(data: {
        sessionId: string;
        inputOctets?: number;
        outputOctets?: number;
        inputPackets?: number;
        outputPackets?: number;
        sessionTime?: number;
    }): Promise<void>;
    /**
     * Handle accounting stop request
     */
    handleAccountingStop(data: {
        sessionId: string;
        terminateCause?: string;
        inputOctets?: number;
        outputOctets?: number;
        inputPackets?: number;
        outputPackets?: number;
        sessionTime?: number;
    }): Promise<void>;
    /**
     * Get an active session by ID
     */
    getSession(sessionId: string): IAccountingSession | undefined;
    /**
     * Get all active sessions
     */
    getActiveSessions(): IAccountingSession[];
    /**
     * Get active sessions by username
     */
    getSessionsByUsername(username: string): IAccountingSession[];
    /**
     * Get active sessions by NAS IP
     */
    getSessionsByNas(nasIpAddress: string): IAccountingSession[];
    /**
     * Get active sessions by VLAN
     */
    getSessionsByVlan(vlanId: number): IAccountingSession[];
    /**
     * Get accounting summary for a time period
     */
    getSummary(startTime: number, endTime: number): Promise<IAccountingSummary>;
    /**
     * Get statistics
     */
    getStats(): {
        activeSessions: number;
        totalSessionsStarted: number;
        totalSessionsStopped: number;
        totalInputBytes: number;
        totalOutputBytes: number;
        interimUpdatesReceived: number;
    };
    /**
     * Disconnect a session (admin action)
     */
    disconnectSession(sessionId: string, reason?: string): Promise<boolean>;
    /**
     * Clean up old archived sessions based on retention policy
     */
    cleanupOldSessions(): Promise<number>;
    /**
     * Find the oldest active session
     */
    private findOldestSession;
    /**
     * Evict a session from memory
     */
    private evictSession;
    /**
     * Load active sessions from database
     */
    private loadActiveSessions;
    /**
     * Persist a session to the database (create or update)
     */
    private persistSession;
    /**
     * Get archived (stopped/terminated) sessions for a time period
     */
    private getArchivedSessions;
}
