/**
 * This file is part of the @egodigital/egoose distribution.
 * Copyright (c) e.GO Digital GmbH, Aachen, Germany (https://www.e-go-digital.com/)
 *
 * @egodigital/egoose is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, version 3.
 *
 * @egodigital/egoose is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
import * as mongoose from 'mongoose';
/**
 * A suggestion for a mongo log document.
 */
export interface LogsDocument extends mongoose.Document {
    /**
     * The time, the entry has been created.
     */
    created: Date;
    /**
     * The message.
     */
    message: string;
    /**
     * The optional payload.
     */
    payload?: string;
    /**
     * The type.
     */
    type: number;
    /**
     * The time, the entry has been updated.
     */
    updated?: Date;
    /**
     * The UUID of the entry.
     */
    uuid: string;
}
/**
 * Options for connecting to a database.
 */
export interface MongoDatabaseOptions {
    /**
     * A custom function, that creates a Mongoose connection
     * from objects, when executing MongoDatabase.connect().
     */
    readonly connector?: (opts: MongoDatabaseOptions) => mongoose.Connection | PromiseLike<mongoose.Connection>;
    /**
     * The name of the database.
     */
    readonly database: string;
    /**
     * The host address.
     */
    readonly host: string;
    /**
     * Custom options for an underlying (mongoose) connection.
     */
    readonly mongooseOptions?: any;
    /**
     * Additional options for the connection string.
     */
    readonly options?: string;
    /**
     * The password for the authentification.
     */
    readonly password?: string;
    /**
     * The TCP port.
     */
    readonly port: number;
    /**
     * The user name.
     */
    readonly user?: string;
}
/**
 * Global repository for MongoDB models.
 */
export declare const MONGO_MODELS: {
    [name: string]: mongoose.Model<mongoose.Document>;
};
/**
 * Global repository for MongoDB schemas.
 */
export declare const MONGO_SCHEMAS: {
    [name: string]: mongoose.Schema;
};
/**
 * A MongoDB connection.
 */
export declare class MongoDatabase {
    readonly options: MongoDatabaseOptions;
    private _mongo;
    /**
     * Initializes a new instance of that class.
     *
     * @param {MongoDatabaseOptions} options Connection options.
     */
    constructor(options: MongoDatabaseOptions);
    /**
     * Starts a connection to the server.
     *
     * @return {Promise<boolean>} The promise, which indicates if operation was successful or not.
     */
    connect(): Promise<boolean>;
    /**
     * Closes the current connection.
     *
     * @return {Promise<boolean>} The promise, which indicates if operation was successful or not.
     */
    disconnect(): Promise<boolean>;
    /**
     * Gets if there is currently an open database connection or not.
     */
    get isConnected(): boolean;
    /**
     * Returns a model by name.
     *
     * @param {string} name The name of the model.
     *
     * @return {mongoose.Model<T>} The model.
     */
    model<T extends mongoose.Document = mongoose.Document>(name: string): mongoose.Model<T>;
    /**
     * Gets the underlying database connection.
     */
    get mongo(): mongoose.Connection;
    /**
     * Starts a query for a schema and a list of results.
     *
     * @param {string} schema The name of the schema.
     * @param {string} func The name of the initial function.
     * @param {any[]} [args] One or more argument for the function, like a condition.
     *
     * @return {mongoose.DocumentQuery<mongoose.Document[], mongoose.Document>} The query.
     */
    query<T extends mongoose.Document = mongoose.Document>(schema: string, func: string, ...args: any[]): mongoose.DocumentQuery<T[], T>;
    /**
     * Starts a query for a schema and a single result.
     *
     * @param {string} schema The name of the schema.
     * @param {string} func The name of the initial function.
     * @param {any[]} [args] One or more argument for the function, like a condition.
     *
     * @return {mongoose.DocumentQuery<mongoose.Document, mongoose.Document>} The query.
     */
    queryOne<T extends mongoose.Document = mongoose.Document>(schema: string, func: string, ...args: any[]): mongoose.DocumentQuery<T, T>;
    /**
     * Returns a schema by name.
     *
     * @param {string} name The name of the schema.
     *
     * @return {mongoose.Schema} The schema.
     */
    schema(name: string): mongoose.Schema;
}
/**
 * Initializes the schema for a 'logs' collection.
 */
export declare function initLogsSchema(): void;
/**
 * Checks if a value can be used as Mongo object ID or not.
 *
 * @param {any} val The value to check.
 *
 * @return {boolean} Can be used as object ID or not.
 */
export declare function isMongoId(val: any): boolean;
