import { type IAdtResponse } from '@mcp-abap-adt/interfaces';
import type { SapConfig } from '../config/sapConfig.js';
import type { ILogger } from '../logger.js';
import type { AbapConnection, AbapRequestOptions } from './AbapConnection.js';
declare abstract class AbstractAbapConnection implements AbapConnection {
    private readonly config;
    protected readonly logger: ILogger | null;
    private axiosInstance;
    private csrfToken;
    private cookies;
    private cookieStore;
    private baseUrl;
    private sessionId;
    private sessionMode;
    private skipSessionType;
    protected constructor(config: SapConfig, logger: ILogger | null, sessionId?: string, options?: {
        skipSessionType?: boolean;
    });
    /**
     * Set session type (stateful or stateless)
     * Controls whether x-sap-adt-sessiontype: stateful header is added to requests
     * - stateful: SAP maintains session state between requests (locks, transactions)
     * - stateless: Each request is independent
     *
     * When skipSessionType is enabled (via constructor options), this is a no-op:
     * the x-sap-adt-sessiontype header will never be sent. This is needed for
     * older BASIS versions (e.g. 7.40) where the stateful header causes locks
     * to be stored in ABAP session memory instead of the global enqueue table,
     * resulting in HTTP 423 on subsequent PUT requests.
     */
    setSessionType(type: 'stateful' | 'stateless'): void;
    /**
     * Get current session mode
     */
    getSessionMode(): 'stateless' | 'stateful';
    /**
     * Set session ID
     * @deprecated Session ID is auto-generated, use setSessionType() to control session mode
     */
    setSessionId(sessionId: string): void;
    /**
     * Get current session ID
     */
    getSessionId(): string | null;
    getConfig(): SapConfig;
    reset(): void;
    getBaseUrl(): Promise<string>;
    getAuthHeaders(): Promise<Record<string, string>>;
    /**
     * Connect to SAP system and initialize session (get CSRF token and cookies)
     * This should be called explicitly before making the first request to ensure
     * proper authentication and session initialization.
     *
     * Concrete implementations must provide auth-specific connection logic:
     * - BaseAbapConnection: Basic auth with CSRF token fetch
     * - JwtAbapConnection: JWT auth with token refresh on 401/403
     */
    abstract connect(): Promise<void>;
    makeAdtRequest<T = any, D = any>(options: AbapRequestOptions): Promise<IAdtResponse<T, D>>;
    protected abstract buildAuthorizationHeader(): string;
    /**
     * Fetch CSRF token from SAP system
     * Protected method for use by concrete implementations in their connect() method
     */
    protected fetchCsrfToken(url: string, retryCount?: number, retryDelay?: number): Promise<string>;
    /**
     * Fetch CSRF token from a specific endpoint with retries
     */
    private fetchCsrfTokenFromEndpoint;
    /**
     * Get CSRF token (protected for use by subclasses)
     */
    protected getCsrfToken(): string | null;
    /**
     * Set CSRF token (protected for use by subclasses)
     */
    protected setCsrfToken(token: string | null): void;
    /**
     * Get cookies (protected for use by subclasses)
     */
    protected getCookies(): string | null;
    protected setInitialCookies(cookies: string): void;
    private updateCookiesFromResponse;
    private getAxiosInstance;
    private ensureFreshCsrfToken;
    private shouldRetryCsrf;
}
export { AbstractAbapConnection };
//# sourceMappingURL=AbstractAbapConnection.d.ts.map