import type { BodyInit } from "bun";
import type { NextFunc, Resolver } from "../hook/event.js";
import { File as FilesystemFile } from "../filesystem/file.js";
import { ApiError } from "./api_error.js";
export declare const ErrUnsupportedContentType: ApiError;
export declare const ErrInvalidRedirectStatusCode: ApiError;
export declare const ErrFileNotFound: ApiError;
export declare const IndexPage = "index.html";
export declare const DefaultMaxMemory: number;
export type CookieLike = {
    Name?: string;
    Value?: string;
    Path?: string;
    Domain?: string;
    Expires?: Date;
    MaxAge?: number;
    Secure?: boolean;
    HttpOnly?: boolean;
    SameSite?: "Strict" | "Lax" | "None";
};
type EventOptions = {
    request: Request;
    params?: Record<string, string>;
    remoteAddress?: string | null;
    remoteAddressResolver?: (() => string | null) | null;
    next?: NextFunc | null;
    flush?: (() => void) | null;
    requestUrl?: URL;
};
type ResponseWriterCompat = {
    Header: () => Headers;
    header: () => Headers;
};
export declare class Event implements Resolver {
    #private;
    Response: ResponseWriterCompat;
    request: Request;
    params: Record<string, string>;
    responseHeaders: Headers;
    constructor(options: EventOptions);
    Next(): unknown;
    nextFunc(): NextFunc | null;
    setNextFunc(fn: NextFunc | null): void;
    next(): Promise<unknown>;
    Written(): boolean;
    Status(): number;
    Flush(): Error | null;
    Cleanup(): Promise<void>;
    requestUrl(): URL;
    IsTLS(): boolean;
    SetCookie(cookie: CookieLike): void;
    RemoteIP(): string;
    remoteIP(): string;
    FindUploadedFiles(key: string): Promise<FilesystemFile[]>;
    Get(key: string): unknown;
    GetAll(): Record<string, unknown>;
    Set(key: string, value: unknown): void;
    SetAll(data: Record<string, unknown>): void;
    String(status: number, data: string): Response;
    HTML(status: number, data: string): Response;
    JSON(status: number, data: unknown): Response;
    XML(status: number, data: unknown): Response;
    Stream(status: number, contentType: string, reader: BodyInit): Response;
    Blob(status: number, contentType: string, blob: Uint8Array): Response;
    FileFS(fsys: string | {
        root: string;
    }, filename: string): Promise<Response | ApiError>;
    NoContent(status: number): Response;
    Redirect(status: number, url: string): Response | ApiError;
    json(status: number, body: unknown): Response;
    html(status: number, body: string): Response;
    string(status: number, body: string): Response;
    xml(status: number, body: unknown): Response;
    stream(status: number, contentType: string, reader: BodyInit): Response;
    blob(status: number, contentType: string, blob: Uint8Array): Response;
    noContent(status: number): Response;
    redirect(status: number, url: string): Response | ApiError;
    Error(status: number, message: string, errData: unknown): ApiError;
    BadRequestError(message: string, errData: unknown): ApiError;
    NotFoundError(message: string, errData: unknown): ApiError;
    ForbiddenError(message: string, errData: unknown): ApiError;
    UnauthorizedError(message: string, errData: unknown): ApiError;
    TooManyRequestsError(message: string, errData: unknown): ApiError;
    InternalServerError(message: string, errData: unknown): ApiError;
    bindBody<T extends object>(target: T): Promise<void>;
    BindBody<T extends object>(target: T): Promise<void>;
    private setResponseHeaderIfEmpty;
    private cachedJsonFields;
    private buildResponse;
}
export {};
