import { Filter, NostrEvent } from "nostr-tools";
import { Observable } from "rxjs";
import { AddressPointer, EventPointer, ProfilePointer } from "nostr-tools/nip19";
import { AddressPointerWithoutD } from "../helpers/pointers.js";
import { EventSet } from "./event-set.js";
import { IEventStore, ModelConstructor } from "./interface.js";
/** An extended {@link EventSet} that handles replaceable events, delets, and models */
export declare class EventStore implements IEventStore {
    database: EventSet;
    /** Enable this to keep old versions of replaceable events */
    keepOldVersions: boolean;
    /** Enable this to keep expired events */
    keepExpired: boolean;
    /**
     * A method used to verify new events before added them
     * @returns true if the event is valid, false if it should be ignored
     */
    verifyEvent?: (event: NostrEvent) => boolean;
    /** A stream of new events added to the store */
    insert$: Observable<NostrEvent>;
    /** A stream of events that have been updated */
    update$: Observable<NostrEvent>;
    /** A stream of events that have been removed */
    remove$: Observable<NostrEvent>;
    /**
     * A method that will be called when an event isn't found in the store
     * @experimental
     */
    eventLoader?: (pointer: EventPointer) => Observable<NostrEvent> | Promise<NostrEvent | undefined>;
    /**
     * A method that will be called when a replaceable event isn't found in the store
     * @experimental
     */
    replaceableLoader?: (pointer: AddressPointerWithoutD) => Observable<NostrEvent> | Promise<NostrEvent | undefined>;
    /**
     * A method that will be called when an addressable event isn't found in the store
     * @experimental
     */
    addressableLoader?: (pointer: AddressPointer) => Observable<NostrEvent> | Promise<NostrEvent | undefined>;
    constructor();
    protected deletedIds: Set<string>;
    protected deletedCoords: Map<string, number>;
    protected checkDeleted(event: string | NostrEvent): boolean;
    protected expirations: Map<string, number>;
    /** Adds an event to the expiration map */
    protected addExpiration(event: NostrEvent): void;
    protected expirationTimeout: number | null;
    protected nextExpirationCheck: number | null;
    protected handleExpiringEvent(event: NostrEvent): void;
    /** Remove expired events from the store */
    protected pruneExpired(): void;
    protected handleDeleteEvent(deleteEvent: NostrEvent): void;
    /** Copies important metadata from and identical event to another */
    static mergeDuplicateEvent(source: NostrEvent, dest: NostrEvent): void;
    /**
     * Adds an event to the store and update subscriptions
     * @returns The existing event or the event that was added, if it was ignored returns null
     */
    add(event: NostrEvent, fromRelay?: string): NostrEvent | null;
    /** Removes an event from the database and updates subscriptions */
    remove(event: string | NostrEvent): boolean;
    /** Add an event to the store and notifies all subscribes it has updated */
    update(event: NostrEvent): boolean;
    /** Removes any event that is not being used by a subscription */
    prune(max?: number): number;
    /** Check if the store has an event by id */
    hasEvent(id: string): boolean;
    /** Get an event by id from the store */
    getEvent(id: string): NostrEvent | undefined;
    /** Check if the store has a replaceable event */
    hasReplaceable(kind: number, pubkey: string, d?: string): boolean;
    /** Gets the latest version of a replaceable event */
    getReplaceable(kind: number, pubkey: string, identifier?: string): NostrEvent | undefined;
    /** Returns all versions of a replaceable event */
    getReplaceableHistory(kind: number, pubkey: string, identifier?: string): NostrEvent[] | undefined;
    /** Get all events matching a filter */
    getByFilters(filters: Filter | Filter[]): Set<NostrEvent>;
    /** Returns a timeline of events that match filters */
    getTimeline(filters: Filter | Filter[]): NostrEvent[];
    /** Sets the claim on the event and touches it */
    claim(event: NostrEvent, claim: any): void;
    /** Checks if an event is claimed by anything */
    isClaimed(event: NostrEvent): boolean;
    /** Removes a claim from an event */
    removeClaim(event: NostrEvent, claim: any): void;
    /** Removes all claims on an event */
    clearClaim(event: NostrEvent): void;
    /** A directory of all active models */
    protected models: Map<ModelConstructor<any, any[]>, Map<string, Observable<any>>>;
    /** How long a model should be kept "warm" while nothing is subscribed to it */
    modelKeepWarm: number;
    /** Get or create a model on the event store */
    model<T extends unknown, Args extends Array<any>>(constructor: ModelConstructor<T, Args>, ...args: Args): Observable<T>;
    /**
     * Creates an observable that streams all events that match the filter
     * @param filters
     * @param [onlyNew=false] Only subscribe to new events
     */
    filters(filters: Filter | Filter[], onlyNew?: boolean): Observable<NostrEvent>;
    /** Returns an observable that completes when an event is removed */
    removed(id: string): Observable<never>;
    /** Creates an observable that emits when event is updated */
    updated(event: string | NostrEvent): Observable<NostrEvent>;
    /** Creates a {@link EventModel} */
    event(pointer: string | EventPointer): Observable<NostrEvent | undefined>;
    /** Creates a {@link ReplaceableModel} */
    replaceable(pointer: AddressPointer | AddressPointerWithoutD): Observable<NostrEvent | undefined>;
    replaceable(kind: number, pubkey: string, identifier?: string): Observable<NostrEvent | undefined>;
    /** Subscribe to an addressable event by pointer */
    addressable(pointer: AddressPointer): Observable<NostrEvent | undefined>;
    /** Creates a {@link TimelineModel} */
    timeline(filters: Filter | Filter[], includeOldVersion?: boolean): Observable<NostrEvent[]>;
    /** Subscribe to a users profile */
    profile(user: string | ProfilePointer): Observable<import("../helpers/profile.js").ProfileContent | undefined>;
    /** Subscribe to a users contacts */
    contacts(user: string | ProfilePointer): Observable<ProfilePointer[]>;
    /** Subscribe to a users mutes */
    mutes(user: string | ProfilePointer): Observable<import("../helpers/mutes.js").Mutes | undefined>;
    /** Subscribe to a users NIP-65 mailboxes */
    mailboxes(user: string | ProfilePointer): Observable<{
        inboxes: string[];
        outboxes: string[];
    } | undefined>;
    /** Subscribe to a users blossom servers */
    blossomServers(user: string | ProfilePointer): Observable<URL[]>;
    /** Subscribe to an event's reactions */
    reactions(event: NostrEvent): Observable<import("nostr-tools").Event[]>;
    /** Subscribe to a thread */
    thread(root: string | EventPointer | AddressPointer): Observable<import("../models/thread.js").Thread>;
    /** Subscribe to a event's comments */
    comments(event: NostrEvent): Observable<import("nostr-tools").Event[]>;
    /** @deprecated use multiple {@link EventModel} instead */
    events(ids: string[]): Observable<Record<string, NostrEvent | undefined>>;
    /** @deprecated use multiple {@link ReplaceableModel} instead */
    replaceableSet(pointers: {
        kind: number;
        pubkey: string;
        identifier?: string;
    }[]): Observable<Record<string, NostrEvent | undefined>>;
}
