/**
 * Microsoft Teams Channel Adapter
 *
 * Microsoft Teams integration via the Bot Framework REST API.
 * Uses the Bot Framework v4 protocol for authentication and messaging.
 *
 * Requires:
 * - An Azure Bot resource with a Microsoft App ID and Password
 * - The bot registered in the Teams Developer Portal
 *
 * The adapter receives activities via webhook (HTTP POST to /api/messages)
 * and sends messages via the Bot Framework connector service.
 *
 * Reference: https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference
 */
import type { ChannelConfig, OutboundMessage, DeliveryResult } from '../index.js';
import { BaseChannel } from '../index.js';
/**
 * Teams-specific configuration
 */
export interface TeamsConfig extends ChannelConfig {
    type: 'teams';
    /** Microsoft App ID (from Azure Bot resource) */
    appId: string;
    /** Microsoft App Password/Secret */
    appPassword: string;
    /** Azure AD tenant ID (optional, defaults to 'botframework.com') */
    tenantId?: string;
    /** OAuth authority URL (optional, for sovereign clouds) */
    oauthAuthority?: string;
}
/**
 * Bot Framework Activity
 */
export interface BotFrameworkActivity {
    type: string;
    id?: string;
    timestamp?: string;
    localTimestamp?: string;
    channelId?: string;
    from?: BotFrameworkAccount;
    conversation?: BotFrameworkConversation;
    recipient?: BotFrameworkAccount;
    text?: string;
    textFormat?: string;
    attachments?: BotFrameworkAttachment[];
    entities?: Array<{
        type: string;
        mentioned?: BotFrameworkAccount;
        text?: string;
        [key: string]: unknown;
    }>;
    channelData?: Record<string, unknown>;
    serviceUrl?: string;
    replyToId?: string;
    value?: unknown;
    name?: string;
    action?: string;
    locale?: string;
    localTimezone?: string;
    summary?: string;
    suggestedActions?: {
        actions: Array<{
            type: string;
            title: string;
            value: string;
            image?: string;
        }>;
    };
}
/**
 * Bot Framework account reference
 */
export interface BotFrameworkAccount {
    id: string;
    name?: string;
    aadObjectId?: string;
    role?: string;
}
/**
 * Bot Framework conversation reference
 */
export interface BotFrameworkConversation {
    id: string;
    name?: string;
    isGroup?: boolean;
    conversationType?: string;
    tenantId?: string;
}
/**
 * Bot Framework attachment
 */
export interface BotFrameworkAttachment {
    contentType: string;
    contentUrl?: string;
    content?: unknown;
    name?: string;
    thumbnailUrl?: string;
}
/**
 * Stored conversation reference for proactive messaging
 */
export interface ConversationReference {
    activityId?: string;
    user: BotFrameworkAccount;
    bot: BotFrameworkAccount;
    conversation: BotFrameworkConversation;
    channelId: string;
    serviceUrl: string;
}
/**
 * Microsoft Teams channel using Bot Framework REST API
 */
export declare class TeamsChannel extends BaseChannel {
    private accessToken;
    private tokenExpiry;
    private conversationRefs;
    private serviceUrls;
    constructor(config: TeamsConfig);
    private get teamsConfig();
    /**
     * Get a Bot Framework access token
     */
    private getAccessToken;
    /**
     * Make an authenticated request to the Bot Connector API
     */
    private apiRequest;
    /**
     * Connect to Teams by validating the app credentials.
     * The actual message receiving happens via webhooks.
     */
    connect(): Promise<void>;
    /**
     * Disconnect from Teams
     */
    disconnect(): Promise<void>;
    /**
     * Send a message to a Teams conversation
     */
    send(message: OutboundMessage): Promise<DeliveryResult>;
    /**
     * Handle an incoming Bot Framework activity.
     * Call this from your HTTP server when you receive a POST to /api/messages.
     *
     * @param activity - The parsed request body (Bot Framework Activity)
     * @param authHeader - The Authorization header from the request (for validation)
     */
    handleActivity(activity: BotFrameworkActivity, authHeader?: string): Promise<void>;
    /**
     * Handle a message activity
     */
    private handleMessageActivity;
    /**
     * Handle conversation update (members added/removed)
     */
    private handleConversationUpdate;
    /**
     * Handle invoke activity (adaptive card actions, messaging extensions, etc.)
     */
    private handleInvoke;
    /**
     * Store a conversation reference for later proactive messaging
     */
    private storeConversationReference;
    /**
     * Get a stored conversation reference
     */
    getConversationReference(conversationId: string): ConversationReference | undefined;
    /**
     * Send a proactive message to a conversation.
     * The bot must have previously received a message from that conversation.
     */
    sendProactive(conversationId: string, text: string): Promise<DeliveryResult>;
    /**
     * Send typing indicator to a conversation
     */
    sendTyping(conversationId: string): Promise<void>;
    /**
     * Update a previously sent message
     */
    updateMessage(conversationId: string, activityId: string, text: string): Promise<void>;
    /**
     * Delete a previously sent message
     */
    deleteMessage(conversationId: string, activityId: string): Promise<void>;
    /**
     * Build a hero card with buttons
     */
    private buildHeroCard;
    /**
     * Map MIME type to ContentType
     */
    private mimeToContentType;
}
export default TeamsChannel;
