/// <reference types="node" />
import { IncomingMessage, ServerResponse } from 'http';
import { JSONSchema4, JSONSchema6 } from 'json-schema';
import { CoreOptions } from 'request';
export declare type SMSchema = JSONSchema4 | JSONSchema6;
export interface PathJson {
    description?: string;
    operationId?: string;
    tags?: string[];
    summary?: string;
    consumes?: string[];
    parameters: {
        name?: string;
        in?: 'path' | 'form' | 'query' | 'body' | string;
        description?: string;
        required?: boolean;
        type?: string;
        schema?: SMSchema;
        format?: any;
    }[];
    responses: {
        [status: number]: {
            description: string;
            schema?: SMSchema;
        };
    };
    [extra: string]: any;
}
export interface SwaggerJson {
    __mtime?: any;
    swagger?: string;
    info?: any;
    tags?: {
        name?: string;
        description?: string;
    }[];
    paths: {
        [path: string]: {
            [method: string]: PathJson;
        };
    };
    definitions?: SMSchema;
    basePath: string;
    [extra: string]: any;
}
export interface SMAjaxConfig {
    method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS' | 'PATCH' | 'HEAD';
    url: string;
    data?: any;
    form?: any;
    query?: any;
    header?: any;
    path?: any;
    body?: any;
}
export interface SMValidateInfo {
    swagger: {
        path: string;
        basePath: string;
    };
    send: SMAjaxConfig;
    receive: {
        body?: any;
        status: number;
    };
    req: SMAbstractRequest;
    res: SMAbstractResponse;
}
export declare type SMAbstractRequest = IncomingMessage;
export declare type SMAbstractResponse = ServerResponse | IncomingMessage;
export declare type SMAbstractNext = (...args: any[]) => any;
export declare type SMValidator = (info: {
    code: number;
    message?: string;
    result: SMValidateInfo;
}) => any;
export declare const X_SM_PATH = "x-sm-path";
export declare const X_SM_BASEPATH = "x-sm-basepath";
export declare const X_SM_PARAMS = "x-sm-params";
export declare const X_SM_ERROR = "x-sm-error";
export declare type SwaggerGuardMode = 'strict' | 'safe';
export interface String2StringMap {
    [key: string]: string;
}
export interface GuardConfig {
    methodUrl2OperationIdMap?: String2StringMap;
    mode?: SwaggerGuardMode;
    prefixReg?: RegExp;
    badParamsReg?: RegExp;
}
export interface Json2Service {
    url?: string;
    type?: 'yapi' | 'swagger';
    yapiConfig?: {
        required?: boolean;
        bodyJsonRequired?: boolean;
        categoryMap?: String2StringMap | ((cate: string) => string);
    };
    swaggerParser?: SwaggerParser;
    validateResponse?: boolean;
    guardConfig?: GuardConfig;
    requestConfig?: {
        url?: string;
    } & CoreOptions;
}
export interface SwaggerParser {
    '-o'?: string;
    '-t'?: string;
    '-l'?: string;
    '-i': string;
}
