import { HotServer } from "./HotServer";
import { HotRoute } from "./HotRoute";
import { HotClient } from "./HotClient";
import { HotEventMethod, HotRouteMethod, ServerAuthorizationFunction } from "./HotRouteMethod";
import { HotDB } from "./HotDB";
import { HotDBSchema } from "./schemas/HotDBSchema";
/**
 * The API to load.
 */
export type APItoLoad = {
    /**
     * The imported class to load.
     */
    importedAPIClass: any;
    /**
     * The exported class name to import and instantiate.
     */
    exportedClassName: string;
    /**
     * The path to the HotAPI class to load.
     */
    path: string;
};
/**
 * The type of object to use during event executions.
 */
export declare enum EventExecutionType {
    HotRoute = 0,
    HotMethod = 1,
    HotAPI = 2
}
/**
 * The API to use.
 */
export declare abstract class HotAPI {
    /**
     * The server connection.
     */
    connection: HotServer | HotClient;
    /**
     * The description of the API.
     */
    description: string;
    /**
     * The authentication token to provide to the API.
     */
    bearerToken: string;
    /**
     * The base url for the server.
     */
    baseUrl: string;
    /**
     * If set, this will create the route variables and functions for
     * easy client/server calling.
     */
    createFunctions: boolean;
    /**
     * The database connection.
     */
    executeEventsUsing: EventExecutionType;
    /**
     * The database connection.
     */
    db: HotDB;
    /**
     * Additional OpenAPI documentation to be added. Anything added here
     * will be merged into the OpenAPI documentation as a JSON object.
     */
    openAPI: {
        info?: any;
        security?: any;
        tags?: any;
        components?: any;
        /**
         * Any extra information to add to the OpenAPI documentation.
         */
        extra?: any;
    };
    /**
     * The function used for user authentication.
     */
    userAuth: ServerAuthorizationFunction;
    /**
     * The database connection.
     */
    routes: {
        [name: string]: HotRoute;
    };
    /**
     * Executed when the API is about to start registering routes. If
     * this function returns false, the server will not start.
     */
    onPreRegister: () => Promise<boolean>;
    /**
     * Executed when the API has finished registering routes. If
     * this function returns false, the server will not start.
     */
    onPostRegister: () => Promise<boolean>;
    constructor(baseUrl: string, connection: HotServer | HotClient, db?: HotDB);
    /**
     * Set the database schema for use.
     */
    setDBSchema(schema: HotDBSchema): void;
    /**
     * Get the database being used.
     */
    getDB(): HotDB;
    /**
     * Get the database schema being used.
     */
    getDBSchema(): HotDBSchema;
    /**
     * Add a route. If this.createFunctions is set to true (which is default), this will take the incoming
     * route and create an object in this HotAPI object using the name of the route. If there's
     * any HotRouteMethods inside of the incoming HotRoute, it will create the methods
     * and attach them to the newly created HotRoute object.
     *
     * @example
     * ```ts
     * import { HotAPI, HotRoute } from "hotstaq";
     *
     * class AppAPI extends HotAPI
     * {
     * 		constructor (baseUrl: string, connection: HotServer | HotClient = null, db: any = null)
     * 		{
     * 			super(baseUrl, connection, db);
     *
     * 			// Creates the route http://127.0.0.1:8080/v1/hello_world/
     * 			this.addRoute (new ExampleRoute (this));
     * 		}
     * }
     *
     * class ExampleRoute extends HotRoute
     * {
     * 		constructor (api: AppAPI)
     * 		{
     * 			super (api.connection, "hello_world");
     *
     * 			// Creates the HTTP GET endpoint: http://127.0.0.1:8080/v1/hello_world/hi
     * 			// When this endpoint is accessed, the JSON response will return "hello"
     * 			this.addMethod ("hi", async () =>
     * 			{
     * 				return ("hello");
     * 			});
     * 		}
     * }
     * ```
     *
     * In the client browser, this would be used like so:
     * ```
     * await Hot.API.hello_world.hi ();
     * ```
     *
     * @param route The route to add. Can be either a full HotRoute object, or just
     * the route's name. If a HotRoute object is supplied, the rest of the parameters
     * will be ignored.
     * @param routeMethod The route's method to add. If the route parameter is a string,
     * it will be interpreted as the route's name, and this will be the method added to
     * the new route.
     * @param executeFunction The function to execute when routeMethod is called by the API.
     */
    addRoute(route: HotRoute | string, routeMethod?: HotRouteMethod | string, executeFunction?: (req: any, res: any, authorizedValue: any, jsonObj: any, queryObj: any) => Promise<any>): void;
    /**
     * Create the API route methods for use in api.my_route.my_method ().
     */
    createAPIRouteMethods(routeName: string): void;
    /**
     * Register a route with the server.
     */
    registerRoute(route: HotRoute): Promise<void>;
    /**
     * Register all routes with the server.
     */
    registerRoutes(): Promise<void>;
    /**
     * Make a call to the API.
     */
    makeCall(route: string, data: any, httpMethod?: HotEventMethod, files?: {
        [name: string]: any;
    }, bearerToken?: string): Promise<any>;
}
//# sourceMappingURL=HotAPI.d.ts.map