import 'reflect-metadata';
import { LoggerInterface } from '@worktif/utils';
import type { LambdaEventApi } from '@worktif/purews';
import { SeoProvider } from '../seo/seo.provider';
import type { RuntimeWebResponse } from '../../types/ssr.types';
import { EnvConfigRuntime } from '../../config/env.config.runtime';
import { StaticS3Service } from '../aws';
/**
 * SsrService is responsible for orchestrating serverless rendering of React applications.
 *
 * This service implements Layer 1 of the serverless rendering pipeline architecture, handling:
 * - React Router static handler creation and query execution
 * - React component tree rendering via renderToPipeableStream
 * - SEO metadata population from SeoProvider
 * - Error handling with structured error responses
 *
 * The service returns a structured RuntimeWebResponse containing:
 * - statusCode: HTTP status code (200, 404, 500, etc.)
 * - bodyHtml: React-rendered application content only (no document-level tags)
 * - seo: Complete SEO metadata for the route
 *
 * This structured response is then passed to Layer 2 (HtmlTemplateService) for
 * wrapping in a complete HTML document, or returned as JSON in unix-shell mode.
 */
export declare class SsrService implements LoggerInterface {
    protected envConfig: EnvConfigRuntime;
    private seoProvider;
    private s3Service;
    /**
     * Logger instance for the serverless rendering service.
     */
    loggerInstance: import("@aws-lambda-powertools/logger").Logger;
    /**
     * Constructor for initializing the class with dependencies.
     *
     * @param {EnvConfigRuntime} envConfig The environment configuration that provides runtime configuration settings.
     * @param {SeoProvider} seoProvider The SEO provider used for handling SEO-related operations.
     * @param {StaticS3Service} s3Service The S3 service instance for managing static assets.
     * @return {void}
     */
    constructor(envConfig: EnvConfigRuntime, seoProvider: SeoProvider, s3Service: StaticS3Service);
    /**
     * Renders a React application and returns a structured response.
     *
     * This is the main entry point for serverless rendering rendering. It orchestrates the following steps:
     * 1. Extract route from event and fetch SEO metadata
     * 2. Create React Router static handler and query context
     * 3. Build React component tree with router
     * 4. Render React tree to HTML string (body content only)
     * 5. Return structured RuntimeWebResponse with status, HTML, and SEO
     *
     * Error handling:
     * - Component errors: Returns 500 status with error message in bodyHtml
     * - Router errors: Returns 500 status with error message
     * - SEO errors: Handled by SeoProvider (returns defaults)
     *
     * @param {LambdaEventApi<any, 'get'>} event - The Lambda API Gateway event.
     * @param {any} runtimeThreads - The Runtime Web runtimeThreads configuration containing app and router.
     * @return {Promise<RuntimeWebResponse>} Structured response with status, HTML, and SEO.
     */
    renderReactApp(event: LambdaEventApi<any, 'get'>, runtimeThreads: any): Promise<RuntimeWebResponse>;
    /**
     * Converts a React application represented as a React element into an HTML string.
     * This method uses streams to render the React application and provides error handling during the rendering process.
     *
     * @param {React.ReactElement} reactApp - The React application to render.
     * @param {any} runtime - Runtime information or configuration needed during the rendering process.
     * @param {string} entryPoint - The entry point for the application, used for identifying the rendered output.
     * @return {Promise<string>} A promise that resolves to the rendered HTML string.
     */
    private renderToString;
    /**
     * Builds a Web Request object from a Lambda API Gateway event.
     *
     * This method converts the Lambda event format into a standard Web Request
     * that React Router can process. It handles:
     * - URL construction from host header and path
     * - Protocol detection (x-forwarded-proto or default to https)
     * - Query string parameters
     * - HTTP headers
     * - Request body for POST/PUT/PATCH methods
     *
     * The resulting Request object is compatible with React Router's static handler
     * and follows web standards for server-side request handling.
     *
     * @param {LambdaEventApi<any, 'post'>} event - The Lambda API Gateway event.
     * @return {Request} A Web Request object for React Router.
     * @private
     */
    private buildWebRequest;
    /**
     * Constructs and normalizes a route path string from an array of path segments.
     * Ensures a consistent path structure by handling redundant slashes and any specified environment stage mappings.
     *
     * @param event
     * @return {string} The constructed and normalized route path as a string.
     */
    routePath(event: any): string;
}
