import EventEmitter from "events";
import type { CreateNewLocalCommunityUserOptions } from "../../community/types.js";
import type { CommentChallengeRequestToEncryptType } from "../../publications/comment/types.js";
import type { VoteChallengeRequestToEncryptType } from "../../publications/vote/types.js";
import type { CommentEditChallengeRequestToEncryptType } from "../../publications/comment-edit/types.js";
import type { CommentModerationChallengeRequestToEncrypt } from "../../publications/comment-moderation/types.js";
import type { CommunityEditChallengeRequestToEncryptType } from "../../publications/community-edit/types.js";
import type { PKCWsServerSettingsSerialized } from "../../rpc/src/types.js";
import type { CommentIpfsType } from "../../publications/comment/types.js";
import { SetNewSettingsPKCWsServerSchema } from "../../rpc/src/schema.js";
import * as z from "zod";
import { TypedEmitter } from "tiny-typed-emitter";
import type { PKCRpcClientEvents } from "../../types.js";
import type { AuthorNameRpcParam, CommunityIdentifierRpcParam, CidRpcParam, FetchCidRpcParam, CommentPageRpcParam, CommunityPageRpcParam, EditCommunityRpcParam, PublishChallengeAnswersRpcParam, RpcInternalCommunityRecordBeforeFirstUpdateType, RpcLocalCommunityUpdateResultType, RpcCommentPageResult, RpcCommunityPageResult, RpcResolveAuthorNameResult, RpcSubscriptionIdResult, RpcSuccessResult, RpcFetchCidResult, ExportCommunityRpcParam, CancelExportRpcParam, RpcExportCommunityResult, ExportCommunityModLogsRpcParam, RpcExportCommunityModLogsResult } from "./types.js";
export default class PKCRpcClient extends TypedEmitter<PKCRpcClientEvents> {
    state: "stopped" | "connecting" | "failed" | "connected";
    communities: string[];
    settings?: PKCWsServerSettingsSerialized;
    private _webSocketClient;
    private _websocketServerUrl;
    private _subscriptionEvents;
    private _pendingSubscriptionMsgs;
    private _timeoutSeconds;
    private _openConnectionPromise?;
    private _destroyRequested;
    constructor(rpcServerUrl: string);
    setState(newState: PKCRpcClient["state"]): void;
    _init(): Promise<void>;
    destroy(): Promise<void>;
    toJSON(): undefined;
    getSubscription(subscriptionId: number): EventEmitter<[never]>;
    unsubscribe(subscriptionId: number): Promise<void>;
    private _deserializeRpcError;
    private _setErrorName;
    private _assignAdditionalProps;
    emitAllPendingMessages(subscriptionId: number): void;
    getComment(args: CidRpcParam): Promise<CommentIpfsType>;
    getCommentPage(page: CommentPageRpcParam): Promise<RpcCommentPageResult>;
    getCommunityPage(page: CommunityPageRpcParam): Promise<RpcCommunityPageResult>;
    createCommunity(createCommunityOptions: CreateNewLocalCommunityUserOptions): Promise<RpcInternalCommunityRecordBeforeFirstUpdateType>;
    private _initSubscriptionEvent;
    startCommunity(communityIdentifier: CommunityIdentifierRpcParam): Promise<RpcSubscriptionIdResult>;
    stopCommunity(communityIdentifier: CommunityIdentifierRpcParam): Promise<RpcSuccessResult>;
    editCommunity(args: EditCommunityRpcParam): Promise<RpcLocalCommunityUpdateResultType>;
    deleteCommunity(communityIdentifier: CommunityIdentifierRpcParam): Promise<RpcSuccessResult>;
    communityUpdateSubscribe(communityIdentifier: CommunityIdentifierRpcParam): Promise<RpcSubscriptionIdResult>;
    publishComment(commentProps: CommentChallengeRequestToEncryptType): Promise<RpcSubscriptionIdResult>;
    publishCommentEdit(commentEditProps: CommentEditChallengeRequestToEncryptType): Promise<RpcSubscriptionIdResult>;
    publishCommentModeration(commentModProps: CommentModerationChallengeRequestToEncrypt): Promise<RpcSubscriptionIdResult>;
    publishVote(voteProps: VoteChallengeRequestToEncryptType): Promise<RpcSubscriptionIdResult>;
    publishCommunityEdit(communityEdit: CommunityEditChallengeRequestToEncryptType): Promise<RpcSubscriptionIdResult>;
    commentUpdateSubscribe(args: CidRpcParam): Promise<RpcSubscriptionIdResult>;
    publishChallengeAnswers(args: PublishChallengeAnswersRpcParam): Promise<RpcSuccessResult>;
    resolveAuthorName(parsedAuthorName: AuthorNameRpcParam): Promise<RpcResolveAuthorNameResult>;
    initalizeCommunitieschangeEvent(): Promise<void>;
    initalizeSettingschangeEvent(): Promise<void>;
    fetchCid(args: FetchCidRpcParam): Promise<RpcFetchCidResult>;
    setSettings(settings: z.input<typeof SetNewSettingsPKCWsServerSchema>): Promise<RpcSuccessResult>;
    rpcCall(method: string, params: any[]): Promise<any>;
    get rpcHttpOrigin(): string;
    exportCommunity(args: ExportCommunityRpcParam): Promise<RpcExportCommunityResult>;
    exportCommunityModLogs(args: ExportCommunityModLogsRpcParam): Promise<RpcExportCommunityModLogsResult>;
    exportsSubscribe(args: CommunityIdentifierRpcParam): Promise<RpcSubscriptionIdResult>;
    cancelExport(args: CancelExportRpcParam): Promise<RpcSuccessResult>;
    getDefaults(): Promise<void>;
    getPeers(): Promise<void>;
    getStats(): Promise<void>;
}
