import { CloudEnvironment, Credentials, InvokeResponse, IToken } from '@microsoft/teams.api';
import { ILogger } from '@microsoft/teams.common';
import { IActivityEvent, ICoreActivity } from '../events';
import { ServiceTokenValidator } from '../middleware/auth/service-token-validator';
import { HttpMethod, IHttpServerAdapter, IHttpServerRequest, IHttpServerResponse, HttpRouteHandler } from './adapter';
type AuthResult = {
    success: true;
    token: IToken;
} | {
    success: false;
    error: string;
};
export type HttpServerOptions = {
    readonly skipAuth?: boolean;
    readonly logger?: ILogger;
    /**
     * URL path for the Teams messaging endpoint
     */
    readonly messagingEndpoint: string;
};
/**
 * Public interface for HttpServer, exposed via DI for plugins
 */
export interface IHttpServer {
    handleRequest(request: IHttpServerRequest): Promise<IHttpServerResponse>;
    readonly adapter: IHttpServerAdapter;
    readonly messagingEndpoint: string;
}
/**
 * Configurable HTTP server for receiving Teams activities
 */
export declare class HttpServer implements IHttpServer {
    /**
     * Callback invoked when a valid activity request arrives
     * App should set this to process activities
     */
    onRequest?: (event: IActivityEvent) => Promise<InvokeResponse>;
    protected logger: ILogger;
    protected credentials?: Credentials;
    protected skipAuth: boolean;
    protected cloud?: CloudEnvironment;
    protected initialized: boolean;
    protected serviceTokenValidator?: ServiceTokenValidator;
    private _adapter;
    private _messagingEndpoint;
    /**
     * Get the underlying adapter
     * Useful for plugins that need adapter-specific features
     */
    get adapter(): IHttpServerAdapter;
    /**
     * Get the messaging endpoint path
     */
    get messagingEndpoint(): string;
    constructor(adapter: IHttpServerAdapter, options: HttpServerOptions);
    /**
     * Initialize the server with dependencies (registers routes, prepares adapter)
     * Can be called multiple times - only initializes once
     * Called by App.initialize()
     */
    initialize(deps: {
        credentials?: Credentials;
        cloud?: CloudEnvironment;
    }): Promise<void>;
    /**
     * Start the HTTP server
     * Called by App.start()
     */
    start(port: number | string): Promise<void>;
    /**
     * Stop the HTTP server
     * Called by App.stop() if implemented
     */
    stop(): Promise<void>;
    /**
     * Register a route handler with the adapter
     * Used by app.function() and other app methods
     */
    registerRoute(method: HttpMethod, path: string, handler: HttpRouteHandler): void;
    /**
     * Serve static files from a directory
     * Used by app.tab() and other app methods
     */
    serveStatic(path: string, directory: string): void;
    /**
     * Handle incoming activity request
     * Validates JWT, dispatches to app, returns response
     */
    handleRequest(request: IHttpServerRequest): Promise<IHttpServerResponse>;
    /**
     * Authorize the request by validating the JWT token.
     */
    protected authorize(headers: Record<string, string | string[]>, body: ICoreActivity): Promise<AuthResult>;
}
export {};
