import type { DatabaseAdapter } from './engine';
import type { DatabaseDomainInterface } from './interfaces';
import type { model } from './models/model';
import type { DatabaseConfigurationType, DatabaseSettingsType, FoundModelType, InitializedEngineInstanceWithModelsType, InitializedEngineInstancesType, OptionalMakemigrationsArgsType } from './types';
declare global {
    var $PDatabaseInstance: Databases | undefined;
}
export declare class Databases {
    #private;
    settings: DatabaseSettingsType;
    isInitializing: boolean;
    isInitialized: boolean;
    initializedEngineInstances: Partial<InitializedEngineInstancesType>;
    obligatoryModels: ReturnType<typeof model>[];
    managers: Map<any, any>;
    constructor();
    /**
     * This will lazy initialize the hole engine instance with all of the models before using it.
     * Generally this is not needed but for example on cases like serverless. We need to guarantee that
     * the database will work without the need of the default domain lifecycle. That's because
     * on certain environments we can't guarantee that the hole domain lifecycle will be called and executed,
     * this is why we need to lazy initialize it.
     *
     * We initialize the hole engine AND NOT JUST THE MODELS because there is no way to know before hand about relations.
     * Yeah we can guarantee direct  relations, for example `Post` that are related to a `User`. But we cannot
     * guarantee indirect relations, for example, that `User` is related to `Post`. This is because of the architecture
     * that we choose to keep all relations in the models themselves. If we change this architecture we are able to lazy
     * load just certain models as well as their relations so it can be even more efficient. Right now we thinks
     * that this is efficient enough.
     *
     * @param engineName - The name of the engine that we want to lazy initialize.
     * @param settings - The settings that we want to use.
     * @param domains - The domains of the application.
     */
    lazyInitializeEngine(engineName: string, settings: DatabaseSettingsType, domains: DatabaseDomainInterface[]): Promise<void>;
    /**
     * Initializes the database connection and load the models to their respective engines.
     *
     * @param settings - The settings object from the file itself.
     */
    init(settings: DatabaseSettingsType, domains: DatabaseDomainInterface[]): Promise<void>;
    /**
     * Responsible for handling the `makemigrations` command. For this command we must initialize the database first.
     * The user can pass --empty to create a new empty migration file.
     *
     * @param settings - The settings defined by the user in settings.js/ts file.
     * @param domains - The domains defined by the user so we can fetch all of the models and migrations.
     */
    makeMigrations(settings: DatabaseSettingsType, domains: DatabaseDomainInterface[], optionalArgs: OptionalMakemigrationsArgsType): Promise<void>;
    /**
     * Responsible for handling the `migrate` command. For this command we must initialize the database first.
     *
     * @param settings - The settings defined by the user in settings.js/ts file.
     * @param domains - The domains defined by the user so we can fetch all of the models and migrations.
     */
    migrate(settings: DatabaseSettingsType, domains: DatabaseDomainInterface[]): Promise<void>;
    /**
     * Closes the database connection on all of the initialized engine instances.
     */
    close(): Promise<void>;
    /**
     * Initializes the database connection and load the models to their respective engines.
     *
     * @param engineName - A custom name of the engine that we are using.
     * @param databaseSettings - The settings object for the database.
     */
    initializeDatabase(engineName: string, databaseSettings: DatabaseConfigurationType, domains: DatabaseDomainInterface[]): Promise<void>;
    /**
     * Initializes the models to the engine instance, the engine instance will convert the models to something it
     * can understand. For example on sequelize engine we will convert the models to a sequelize model. On a Prisma
     * engine for example we could interpret the models as a Prisma schema, and we could build the file after.
     *
     * @param engineInstance - The engine instance that we will be using.
     * @param projectModels - The models from the project (not the default ones that we create).
     *
     * @returns - Returns the engine instance that we are using to build run everything over returns the project models
     * and the internal models.
     */
    initializeModels(engineInstance: DatabaseAdapter, projectModels: FoundModelType[]): Promise<InitializedEngineInstanceWithModelsType>;
    /**
     * Retrieves the models on all of the installed domains. By default we will look for the models
     * in the `models` file in the path of the domain. You can also define your domain app implementing
     * the `DatabaseDomainInterface` interface. With this type of domain you are able to export your models by defining
     * the `getModels` method. When this method is defined we bypass the lookup of the models in the `models`
     * file or folder, for complex projects you might want to use this method.
     *
     * @param domains - The domains where we want to retrieve the models from. Those are all of the
     * domains installed with INSTALLED_DOMAINS.
     *
     * @returns - Returns an array of models.
     */
    getModels(engineInstance: DatabaseAdapter, domains?: DatabaseDomainInterface[]): Promise<{
        [modelName: string]: FoundModelType;
    }>;
}
//# sourceMappingURL=databases.d.ts.map