import { ActivityRequest, FeedResponse, GetOrCreateFeedRequest, GetOrCreateFeedResponse, QueryFollowsRequest, WSEvent, ActivityResponse, CommentResponse, QueryFeedMembersRequest, SortParamRequest, FollowRequest, QueryCommentsRequest } from '../gen/models';
import { StreamResponse } from '../gen-imports';
import { StateStore } from '../common/StateStore';
import { EventDispatcher } from '../common/EventDispatcher';
import { FeedApi } from '../gen/feeds/FeedApi';
import { FeedsClient } from '../feeds-client';
import type { ActivityIdOrCommentId, GetCommentsRepliesRequest, GetCommentsRequest, LoadingStates, PagerResponseWithLoadingStates } from '../types';
export type FeedState = Omit<Partial<GetOrCreateFeedResponse & FeedResponse>, 'feed' | 'duration'> & {
    /**
     * True when loading state using `getOrCreate`
     */
    is_loading: boolean;
    /**
     * True when loading activities using `getOrCreate` or `getNextPage`
     */
    is_loading_activities: boolean;
    comments_by_entity_id: Record<ActivityIdOrCommentId, {
        pagination?: PagerResponseWithLoadingStates & {
            sort?: QueryCommentsRequest['sort'] | (string & {});
        };
        /**
         * Id of the "store" where the actual parent is stored in the comments array.
         *
         * Example:
         * ```
         * // top-level comment:
         * const comment1 = {
         *   id: 'comment-1',
         *   object_id: 'activity-1',
         * }
         * // child comment:
         * const comment2 = {
         *   id: 'comment-2',
         *   object_id: 'activity-1',
         *   parent_id: 'comment-1',
         * }
         * ```
         * When these comments are loaded, they're stored in the state like this:
         * ```
         * {
         *   comments_by_entity_id: {
         *     'activity-1': {
         *       comments: [comment1],
         *       entity_parent_id: undefined,
         *     },
         *     'comment-1': {
         *       comments: [comment2],
         *       entity_parent_id: 'activity-1', // parent store where "comment-1" is located in "comments" array
         *     }
         *   }
         * }
         * ```
         */
        entity_parent_id?: ActivityIdOrCommentId;
        comments?: CommentResponse[];
    } | undefined>;
    followers_pagination?: LoadingStates & {
        sort?: SortParamRequest[];
    };
    following_pagination?: LoadingStates & {
        sort?: SortParamRequest[];
    };
    member_pagination?: LoadingStates & {
        sort?: SortParamRequest[];
    };
    last_get_or_create_request_config?: GetOrCreateFeedRequest;
    /**
     * `true` if the feed is receiving real-time updates via WebSocket
     */
    watch: boolean;
};
export declare class Feed extends FeedApi {
    readonly state: StateStore<FeedState>;
    private static readonly noop;
    protected readonly stateUpdateQueue: Set<string>;
    private readonly eventHandlers;
    protected eventDispatcher: EventDispatcher<WSEvent['type'], WSEvent>;
    constructor(client: FeedsClient, groupId: 'user' | 'timeline' | (string & {}), id: string, data?: FeedResponse, watch?: boolean);
    protected readonly client: FeedsClient;
    get feed(): string;
    get currentState(): FeedState;
    synchronize(): Promise<void>;
    getOrCreate(request?: GetOrCreateFeedRequest): Promise<StreamResponse<GetOrCreateFeedResponse>>;
    /**
     * Returns index of the provided comment object.
     */
    protected getCommentIndex(comment: Pick<CommentResponse, 'object_id' | 'parent_id' | 'id'>, state?: FeedState): number;
    /**
     * Load child comments of entity (activity or comment) into the state, if the target entity is comment,
     * `entityParentId` should be provided (`CommentResponse.parent_id ?? CommentResponse.object_id`).
     */
    private loadCommentsIntoState;
    private loadNextPageComments;
    loadNextPageActivityComments(activity: ActivityResponse, request?: Partial<Omit<GetCommentsRequest, 'object_id' | 'object_type' | 'next'>>): Promise<void>;
    loadNextPageCommentReplies(comment: CommentResponse, request?: Partial<Omit<GetCommentsRepliesRequest, 'comment_id' | 'next'>>): Promise<void>;
    private loadNextPageFollows;
    loadNextPageFollowers(request: Pick<QueryFollowsRequest, 'limit' | 'sort'>): Promise<void>;
    loadNextPageFollowing(request: Pick<QueryFollowsRequest, 'limit' | 'sort'>): Promise<void>;
    loadNextPageMembers(request: Omit<QueryFeedMembersRequest, 'next' | 'prev'>): Promise<void>;
    /**
     * Method which queries followers of this feed (feeds which target this feed).
     *
     * _Note: Useful only for feeds with `groupId` of `user` value._
     */
    queryFollowers(request: Omit<QueryFollowsRequest, 'filter'>): Promise<StreamResponse<import("../gen/models").QueryFollowsResponse>>;
    /**
     * Method which queries following of this feed (target feeds of this feed).
     *
     * _Note: Useful only for feeds with `groupId` of `timeline` value._
     */
    queryFollowing(request: Omit<QueryFollowsRequest, 'filter'>): Promise<StreamResponse<import("../gen/models").QueryFollowsResponse>>;
    follow(feedOrFid: Feed | string, options?: Omit<FollowRequest, 'source' | 'target'>): Promise<StreamResponse<import("../gen/models").SingleFollowResponse>>;
    unfollow(feedOrFid: Feed | string): Promise<StreamResponse<import("../gen/models").UnfollowResponse>>;
    getNextPage(): Promise<StreamResponse<GetOrCreateFeedResponse>>;
    addActivity(request: Omit<ActivityRequest, 'feeds'>): Promise<StreamResponse<import("../gen/models").AddActivityResponse>>;
    on: (eventName: "all" | "app.updated" | "feeds.activity.added" | "feeds.activity.deleted" | "feeds.activity.marked" | "feeds.activity.pinned" | "feeds.activity.reaction.added" | "feeds.activity.reaction.deleted" | "feeds.activity.reaction.updated" | "feeds.activity.removed_from_feed" | "feeds.activity.unpinned" | "feeds.activity.updated" | "feeds.bookmark.added" | "feeds.bookmark.deleted" | "feeds.bookmark.updated" | "feeds.bookmark_folder.deleted" | "feeds.bookmark_folder.updated" | "feeds.comment.added" | "feeds.comment.deleted" | "feeds.comment.reaction.added" | "feeds.comment.reaction.deleted" | "feeds.comment.reaction.updated" | "feeds.comment.updated" | "feeds.feed.created" | "feeds.feed.deleted" | "feeds.feed.updated" | "feeds.feed_group.changed" | "feeds.feed_group.deleted" | "feeds.feed_member.added" | "feeds.feed_member.removed" | "feeds.feed_member.updated" | "feeds.follow.created" | "feeds.follow.deleted" | "feeds.follow.updated" | "feeds.notification_feed.updated" | "feeds.poll.closed" | "feeds.poll.deleted" | "feeds.poll.updated" | "feeds.poll.vote_casted" | "feeds.poll.vote_changed" | "feeds.poll.vote_removed" | "health.check" | "user.updated" | "moderation.custom_action" | "moderation.flagged" | "moderation.mark_reviewed" | "user.banned" | "user.deactivated" | "user.muted" | "user.reactivated", handler: (event: WSEvent) => void) => () => void;
    off: (eventName: "all" | "app.updated" | "feeds.activity.added" | "feeds.activity.deleted" | "feeds.activity.marked" | "feeds.activity.pinned" | "feeds.activity.reaction.added" | "feeds.activity.reaction.deleted" | "feeds.activity.reaction.updated" | "feeds.activity.removed_from_feed" | "feeds.activity.unpinned" | "feeds.activity.updated" | "feeds.bookmark.added" | "feeds.bookmark.deleted" | "feeds.bookmark.updated" | "feeds.bookmark_folder.deleted" | "feeds.bookmark_folder.updated" | "feeds.comment.added" | "feeds.comment.deleted" | "feeds.comment.reaction.added" | "feeds.comment.reaction.deleted" | "feeds.comment.reaction.updated" | "feeds.comment.updated" | "feeds.feed.created" | "feeds.feed.deleted" | "feeds.feed.updated" | "feeds.feed_group.changed" | "feeds.feed_group.deleted" | "feeds.feed_member.added" | "feeds.feed_member.removed" | "feeds.feed_member.updated" | "feeds.follow.created" | "feeds.follow.deleted" | "feeds.follow.updated" | "feeds.notification_feed.updated" | "feeds.poll.closed" | "feeds.poll.deleted" | "feeds.poll.updated" | "feeds.poll.vote_casted" | "feeds.poll.vote_changed" | "feeds.poll.vote_removed" | "health.check" | "user.updated" | "moderation.custom_action" | "moderation.flagged" | "moderation.mark_reviewed" | "user.banned" | "user.deactivated" | "user.muted" | "user.reactivated", handler: (event: WSEvent) => void) => void;
    handleWSEvent(event: WSEvent): void;
}
