import { EventEmitter } from "node:events";
import type { VisionClawConfig } from "../config/types.js";
import type { ChannelAdapter, MessageAttachment, ReplyContext } from "./interface.js";
import { type PaymentRequiredPayload, type BundlePurchasePayload } from "../billing/types.js";
/**
 * Telegram channel adapter.
 * Supports multimodal inbound (photos, documents, voice) and
 * outbound (photos, documents) messages.
 */
export declare class TelegramAdapter extends EventEmitter implements ChannelAdapter {
    readonly name = "telegram";
    private config;
    private bot;
    private telegramAccess;
    /** The owner's Telegram user ID (equals telegramChatId for a DM). Used to
     *  authorize admin commands and always trust the owner's direct chat. */
    private _ownerUserId;
    /** Cached plans from the most recent payment prompt, used by the callback handler */
    private _cachedPlans;
    constructor(config: VisionClawConfig);
    /**
     * Set the owner's Telegram user ID so that admin commands are only accepted
     * from the owner, even in group chats.
     */
    setOwnerUserId(id: number): void;
    /** Best-effort read of the owner's language preference for i18n. */
    private getOwnerLocale;
    /** Best-effort read of the owner's timezone preference for settings UI. */
    private getOwnerTimezone;
    /**
     * Drop all Telegram access-control state captured before the owner was
     * established (pending entries + held messages). Called once from the
     * onboarding flow so pre-owner traffic does not leak into the newly
     * onboarded agent.
     */
    clearPreOwnerAccessState(): void;
    start(): Promise<void>;
    private handleIncomingMessage;
    private handleChatMemberUpdate;
    private handleOwnerAdminCommand;
    private handleEngineCommand;
    private handleCallbackQuery;
    /** All recognised bot command patterns (general + admin). */
    private static readonly KNOWN_COMMAND_PATTERN;
    /**
     * Returns true if the message text starts with a known bot command.
     */
    private isKnownCommand;
    /**
     * If the message is a known command from a non-owner chat, reply with
     * a rejection notice and return true so the caller can short-circuit.
     */
    private rejectNonOwnerCommand;
    private handleGeneralCommand;
    private getSenderDisplay;
    /**
     * Build a reply/quote context prefix when a message is replying to another message.
     * Returns empty string if no reply context is present.
     */
    private getReplyContext;
    private shouldEnforceAccessControl;
    private isOwnerDirectMessage;
    private findEntryByChatId;
    private findEntryById;
    private persistTelegramAccess;
    private countHeldMessages;
    private syncPendingMessageCount;
    private capturePendingMessage;
    private notifyOwnerAboutPendingEntry;
    private maybeReplyPendingApproval;
    private buildPendingRequestsReply;
    private buildChatsReply;
    private approveEntry;
    private blockEntry;
    private releaseHeldMessages;
    private sendAdminReply;
    private answerCallbackQuery;
    private clearCallbackButtons;
    private getUsageClient;
    private formatUsageSummary;
    /** In-memory cache of period availability between /usage prompt and button click. */
    private _usagePeriodCache;
    private loadUsagePeriods;
    private sendUsagePeriodPrompt;
    /**
     * Local PDF cache filename. Includes the resolved period range so a roll-over
     * (e.g. month flip) invalidates the previous cache and a fresh PDF is fetched.
     */
    private usagePdfCachePath;
    private sendUsagePdf;
    private handleUsagePdfCallback;
    stop(): Promise<void>;
    sendMessage(to: string, message: string, attachments?: MessageAttachment[], replyTo?: ReplyContext): Promise<void>;
    sendTypingIndicator(to: string): Promise<void>;
    /**
     * Process an inbound Telegram message, resolving media file links
     * before emitting the CommandMessage.
     */
    private processInboundMessage;
    /**
     * Resolve a Telegram file_id to a temporary download URL.
     */
    private resolveFileLink;
    private sendText;
    /** Common timezone options for the inline keyboard. */
    private static readonly TIMEZONE_OPTIONS;
    /** Language options for the inline keyboard. */
    private static readonly LANGUAGE_OPTIONS;
    /**
     * Send a message with a Telegram Mini App (Web App) button.
     */
    sendMiniAppButton(chatId: number, text: string, buttonLabel: string, webAppUrl: string): Promise<void>;
    /**
     * Send the /settings top-level menu with "Language" and "Timezone" buttons.
     */
    sendSetMenu(chatId: number): Promise<void>;
    /**
     * Send the language selection inline keyboard.
     */
    private sendLanguageMenu;
    /**
     * Send the timezone selection inline keyboard.
     */
    private sendTimezoneMenu;
    /**
     * Handle /settings-related callback queries (language and timezone selection).
     */
    private handleSetCallback;
    /**
     * Send a plan selection prompt with inline keyboard buttons.
     * Called by the subscription gate when the subscription expires.
     * Plans come from the heartbeat response, not hardcoded.
     * User taps a plan → billing_plan_selected event is emitted.
     */
    sendPaymentPrompt(chatId: number, payload: PaymentRequiredPayload): Promise<void>;
    /**
     * Send a Stripe Checkout link as a URL button.
     * Called after the payment handler obtains a checkout URL from the backend.
     */
    sendCheckoutLink(chatId: number, planName: string, checkoutUrl: string): Promise<void>;
    /**
     * Send a bundle purchase (one-time top-up) amount selection prompt.
     * Called by the billing handler when the admin dispatches bundle_purchase.
     * User taps an amount → billing_bundle_selected event is emitted.
     */
    sendBundlePrompt(chatId: number, payload: BundlePurchasePayload): Promise<void>;
    /**
     * Handle billing-related callback queries (user tapped a plan or bundle button).
     * Emits a `billing_plan_selected` or `billing_bundle_selected` event.
     */
    private handleBillingCallback;
}
//# sourceMappingURL=telegram.d.ts.map