import { type InferState, type SDKTypes, type ServerRoomLike, type ISeatReservation } from '@colyseus/shared-types';
import { Room } from './Room.ts';
import { SchemaConstructor } from './serializer/SchemaSerializer.ts';
import { HTTP, type FetchFn } from './HTTP.ts';
import { Auth } from './Auth.ts';
export type JoinOptions = any;
export type { ISeatReservation };
export interface EndpointSettings {
    hostname: string;
    secure: boolean;
    port?: number;
    pathname?: string;
    searchParams?: string;
    protocol?: "ws" | "h3";
}
export interface ClientOptions {
    headers?: {
        [id: string]: string;
    };
    urlBuilder?: (url: URL) => string;
    protocol?: "ws" | "h3";
    fetchFn?: FetchFn;
}
export interface LatencyOptions {
    /** "ws" for WebSocket, "h3" for WebTransport (default: "ws") */
    protocol?: "ws" | "h3";
    /** Number of pings to send (default: 1). Returns the average latency when > 1. */
    pingCount?: number;
}
export declare class ColyseusSDK<ServerType extends SDKTypes = any, UserData = any> {
    static VERSION: string;
    /**
     * The HTTP client to make requests to the server.
     */
    http: HTTP<ServerType['~routes']>;
    /**
     * The authentication module to authenticate into requests and rooms.
     */
    auth: Auth<UserData>;
    /**
     * The settings used to connect to the server.
     */
    settings: EndpointSettings;
    protected urlBuilder: (url: URL) => string;
    constructor(settings?: string | EndpointSettings, options?: ClientOptions);
    /**
     * Select the endpoint with the lowest latency.
     * @param endpoints Array of endpoints to select from.
     * @param options Client options.
     * @param latencyOptions Latency measurement options (protocol, pingCount).
     * @returns The client with the lowest latency.
     */
    static selectByLatency<ServerType extends SDKTypes = any, UserData = any>(endpoints: Array<string | EndpointSettings>, options?: ClientOptions, latencyOptions?: LatencyOptions): Promise<ColyseusSDK<ServerType, UserData>>;
    joinOrCreate<R extends keyof ServerType['~rooms'], State = InferState<ServerType['~rooms'][R]['~room'], never>>(roomName: R, options?: Parameters<ServerType['~rooms'][R]['~room']['onJoin']>[1], rootSchema?: SchemaConstructor<State>): Promise<Room<ServerType['~rooms'][R]['~room'], State>>;
    joinOrCreate<RoomType extends ServerRoomLike>(roomName: string, options?: Parameters<NonNullable<RoomType['onJoin']>>[1], rootSchema?: SchemaConstructor<RoomType['state']>): Promise<Room<RoomType, RoomType['state']>>;
    joinOrCreate<State = any>(roomName: string, options?: JoinOptions, rootSchema?: SchemaConstructor<State>): Promise<Room<any, State>>;
    create<R extends keyof ServerType['~rooms'], State = InferState<ServerType['~rooms'][R]['~room'], never>>(roomName: R, options?: Parameters<ServerType['~rooms'][R]['~room']['onJoin']>[1], rootSchema?: SchemaConstructor<State>): Promise<Room<ServerType['~rooms'][R]['~room'], State>>;
    create<RoomType extends ServerRoomLike>(roomName: string, options?: Parameters<NonNullable<RoomType['onJoin']>>[1], rootSchema?: SchemaConstructor<RoomType['state']>): Promise<Room<RoomType, RoomType['state']>>;
    create<State = any>(roomName: string, options?: JoinOptions, rootSchema?: SchemaConstructor<State>): Promise<Room<any, State>>;
    join<R extends keyof ServerType['~rooms'], State = InferState<ServerType['~rooms'][R]['~room'], never>>(roomName: R, options?: Parameters<ServerType['~rooms'][R]['~room']['onJoin']>[1], rootSchema?: SchemaConstructor<State>): Promise<Room<ServerType['~rooms'][R]['~room'], State>>;
    join<RoomType extends ServerRoomLike>(roomName: string, options?: Parameters<NonNullable<RoomType['onJoin']>>[1], rootSchema?: SchemaConstructor<RoomType['state']>): Promise<Room<RoomType, RoomType['state']>>;
    join<State = any>(roomName: string, options?: JoinOptions, rootSchema?: SchemaConstructor<State>): Promise<Room<any, State>>;
    joinById<R extends keyof ServerType['~rooms'], State = InferState<ServerType['~rooms'][R]['~room'], never>>(roomName: R, options?: Parameters<ServerType['~rooms'][R]['~room']['onJoin']>[1], rootSchema?: SchemaConstructor<State>): Promise<Room<ServerType['~rooms'][R]['~room'], State>>;
    joinById<RoomType extends ServerRoomLike>(roomId: string, options?: Parameters<NonNullable<RoomType['onJoin']>>[1], rootSchema?: SchemaConstructor<RoomType['state']>): Promise<Room<RoomType, RoomType['state']>>;
    joinById<State = any>(roomId: string, options?: JoinOptions, rootSchema?: SchemaConstructor<State>): Promise<Room<any, State>>;
    /**
     * Re-establish connection with a room this client was previously connected to.
     *
     * @param reconnectionToken The `room.reconnectionToken` from previously connected room.
     * @param rootSchema (optional) Concrete root schema definition
     * @returns Promise<Room>
     */
    reconnect<R extends keyof ServerType['~rooms']>(reconnectionToken: string, roomName?: R): Promise<Room<ServerType['~rooms'][R]['~room']>>;
    reconnect<RoomType extends ServerRoomLike>(reconnectionToken: string, rootSchema?: SchemaConstructor<RoomType['state']>): Promise<Room<RoomType, RoomType['state']>>;
    reconnect<State = any>(reconnectionToken: string, rootSchema?: SchemaConstructor<State>): Promise<Room<any, State>>;
    consumeSeatReservation<T>(response: ISeatReservation, rootSchema?: SchemaConstructor<T>): Promise<Room<any, T>>;
    /**
     * Create a new connection with the server, and measure the latency.
     * @param options Latency measurement options (protocol, pingCount).
     */
    getLatency(options?: LatencyOptions): Promise<number>;
    protected createMatchMakeRequest<T>(method: string, roomName: string, options?: JoinOptions, rootSchema?: SchemaConstructor<T>): Promise<Room<any, T>>;
    protected createRoom<T>(roomName: string, rootSchema?: SchemaConstructor<T>): Room<any, T>;
    protected buildEndpoint(seatReservation: ISeatReservation, options?: any): string;
    protected getHttpEndpoint(segments?: string): string;
    protected getEndpointPort(): string;
}
export declare const Client: typeof ColyseusSDK;
export type Client<ServerType extends SDKTypes = any, UserData = any> = InstanceType<typeof ColyseusSDK<ServerType, UserData>>;
