import { ILogger, IStorage } from '@microsoft/teams.common';
import { TurnStateContainer } from './container';
import { StateOptions } from './options';
/**
 * Loads and saves per-turn state scopes using app storage.
 *
 * Each save replaces one complete scope. Concurrent turns therefore use
 * last-writer-wins semantics.
 */
export declare class TurnStateLoader {
    private readonly storage;
    private readonly keyPrefix;
    private readonly logger?;
    private readonly persistenceKeys;
    /**
     * Creates a state loader.
     * @param storage Storage for serialized state JSON.
     * @param options State storage and key options.
     * @param logger Optional logger for malformed persisted values.
     */
    constructor(storage: IStorage<string, string>, options?: StateOptions, logger?: ILogger);
    /**
     * Returns the persisted conversation-scope key.
     *
     * The conversation ID is percent-encoded as one key segment.
     * @param conversationId Conversation ID.
     */
    conversationKey(conversationId: string): string;
    /**
     * Returns the persisted user-within-conversation key.
     *
     * The conversation and user IDs are independently percent-encoded so
     * delimiter characters cannot make distinct ID pairs share a key.
     * @param conversationId Conversation ID.
     * @param userId User ID.
     */
    userKey(conversationId: string, userId: string): string;
    /**
     * Loads conversation state and, when a user ID is present, user state.
     * @param conversationId Conversation ID for the activity.
     * @param userId Optional sender ID.
     */
    load(conversationId: string, userId?: string): Promise<TurnStateContainer>;
    /**
     * Persists dirty scopes to the same storage keys from which they were loaded.
     *
     * Manually constructed containers are not bound to storage and cannot be
     * saved. Dirty empty scopes delete their backing keys; clean scopes perform
     * no I/O. Each successfully persisted scope is marked clean independently.
     * @param container Loaded state container to persist.
     */
    save(container: TurnStateContainer): Promise<void>;
    /**
     * Deletes persisted conversation and user scopes without loading them.
     * @param conversationId Conversation ID to delete.
     * @param userId Optional user ID to delete within the conversation.
     */
    delete(conversationId: string, userId?: string): Promise<void>;
    private loadScope;
    private saveScope;
}
/**
 * Creates the app state loader when state is enabled.
 * @param state `true` for defaults, options for custom behavior, or a falsy value to disable state.
 * @param logger Logger used to warn about process-local storage.
 */
export declare function createStateLoader(state: boolean | StateOptions | undefined, logger: ILogger): TurnStateLoader | undefined;
/** @internal Creates the default state loader enabled by OAuth flow registration. */
export declare function createOAuthStateLoader(logger: ILogger): TurnStateLoader;
