export declare namespace Azion {
    export namespace Storage {
        export type ContentObjectStorage = ArrayBuffer | ReadableStream | string | Uint8Array;
        export interface StorageInstance {
            list(): Promise<{
                entries: {
                    key: string;
                    content_length?: number;
                }[];
            }>;
            put(key: string, value: ContentObjectStorage, options?: {
                'content-length'?: string;
                'content-type'?: string;
            }): Promise<void>;
            delete(key: string): Promise<void>;
            get(key: string): Promise<StorageObject>;
        }
        export interface StorageObject {
            arrayBuffer(): Promise<ArrayBuffer>;
            metadata: Map<string, string>;
            contentType: string;
            contentLength: number;
        }
    }
    export namespace Sql {
        export interface Connection {
            query: (sql: string) => Promise<Rows>;
            execute: (sql: string) => Promise<null>;
        }
        export interface Rows {
            next: () => Promise<Row>;
            columnCount: () => number;
            columnName: (index: number) => string;
            columnType: (index: number) => string;
        }
        export interface Row {
            columnName: (index: number) => string;
            columnType: (index: number) => string;
            getValue: (index: number) => any;
            getString: (index: number) => string;
        }
        export interface Database {
            connection: Connection;
            open?: (name: string) => Promise<Connection>;
        }
        export {};
    }
}

/**
 * Base event interface for Azion
 */
export declare interface AzionFetchEvent extends Event {
    request: Request & {
        metadata: AzionRuntimeRequestMetadata;
    };
    waitUntil: (promise: Promise<unknown>) => void;
    respondWith: (response: Response | Promise<Response>) => void;
}

/**
 * Firewall event interface
 */
export declare interface AzionFirewallEvent extends AzionFetchEvent {
    deny: () => void;
    drop: () => void;
    continue: () => void;
}

/**
 * Base context for Azion modules
 */
export declare interface AzionRuntimeCtx {
    waitUntil: (promise: Promise<unknown>) => void;
    args?: Record<string, unknown>;
}

/**
 * Specific context for firewall modules
 */
export declare interface AzionRuntimeFirewallCtx extends AzionRuntimeCtx {
    deny: () => void;
    continue: () => void;
    drop: () => void;
}

/**
 * Generic module type that can handle any combination of fetch and firewall events
 */
export declare interface AzionRuntimeModule {
    fetch?: (request: AzionRuntimeRequest, env?: null, ctx?: AzionRuntimeCtx) => Promise<Response>;
    firewall?: (request: AzionRuntimeRequest, env?: null, ctx?: AzionRuntimeCtx) => Promise<Response>;
}

/**
 * Type for Azion request with metadata
 */
export declare type AzionRuntimeRequest = Request & {
    metadata: AzionRuntimeRequestMetadata;
};

export declare interface AzionRuntimeRequestMetadata {
    geoip_asn: string;
    geoip_city: string;
    geoip_city_continent_code: string;
    geoip_city_country_code: string;
    geoip_city_country_name: string;
    geoip_continent_code: string;
    geoip_country_code: string;
    geoip_country_name: string;
    geoip_region: string;
    geoip_region_name: string;
    remote_addr: string;
    remote_port: string;
    remote_user: string;
    server_protocol: string;
    server_fingerprint: string;
    server_fingerprint_ja4h: string;
    ssl_cipher: string;
    ssl_protocol: string;
    client_fingerprint: string;
    client_id: string;
    configuration_id: string;
    edge_connector_id: string;
    function_id: string;
    http_ssl_ja4: string;
    request_id: string;
    solution_id: string;
    [key: string]: string;
}

/**
 * Event listener type for fetch events
 */
export declare type FetchEventListener = (event: AzionFetchEvent, args?: Record<string, unknown>) => void | Promise<void>;

/**
 * Event listener type for firewall events
 */
export declare type FirewallEventListener = (event: AzionFirewallEvent, args?: Record<string, unknown>) => void | Promise<void>;

export { }
