import { OnGatewayConnection, OnGatewayDisconnect, OnGatewayInit, WsResponse } from '@nestjs/websockets';
import { Server, Socket } from 'socket.io';
import { JwtService } from '../auth/jwt.service';
import { WebsocketRateLimiter } from './websocket.rate-limiter';
export declare enum ChannelPermission {
    READ = "read",
    WRITE = "write",
    ADMIN = "admin"
}
export interface AuthorizedChannel {
    name: string;
    description?: string;
    requiredRoles?: string[];
    requiredPermissions?: string[];
    allowPublicSubscribe?: boolean;
    allowPublicPublish?: boolean;
    allowAnonymous?: boolean;
    defaultUserPermission?: ChannelPermission;
}
export declare class WebsocketGateway implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect {
    private readonly jwtService;
    private readonly rateLimiter?;
    server: Server;
    private readonly logger;
    private connectedClients;
    private channels;
    private channelAcls;
    private lastPingTimestamps;
    private serverStartTime;
    constructor(jwtService: JwtService, rateLimiter?: WebsocketRateLimiter);
    afterInit(server: Server): void;
    handleConnection(client: Socket, ...args: any[]): Promise<void>;
    handleDisconnect(client: Socket): void;
    handleAuthenticate(client: Socket, data: {
        token: string;
    }): Promise<WsResponse<any>>;
    handleSubscribe(client: Socket, data: {
        channel: string;
    }): WsResponse<any>;
    handleUnsubscribe(client: Socket, data: {
        channel: string;
    }): WsResponse<any>;
    handlePublish(client: Socket, data: {
        channel: string;
        event: string;
        payload: any;
    }): WsResponse<any>;
    registerChannel(channelConfig: AuthorizedChannel): boolean;
    unregisterChannel(channelName: string): boolean;
    grantChannelPermission(channelName: string, userId: string | number, permission: ChannelPermission): boolean;
    revokeChannelAccess(channelName: string, userId: string | number): boolean;
    broadcastToChannel(channel: string, event: string, data: any): void;
    sendToClient(clientId: string, event: string, data: any): boolean;
    private autoJoinAuthorizedChannels;
    private canSubscribeToChannel;
    private canPublishToChannel;
    private notifyUserOfPermissionChange;
    private disconnectUserFromChannel;
    getServerStatus(): {
        running: boolean;
        uptime: number;
    };
    getActiveConnectionsCount(): number;
    getActiveChannelsCount(): number;
    pingAllClients(): number;
    handlePong(client: Socket, timestamp: number): void;
    getChannelStats(): Map<string, {
        subscribers: number;
        acls: number;
    }>;
    handleClientPong(client: Socket, data: {
        timestamp: number;
    }): void;
}
