/**
 * @module Lock
 */
import type { TimeSpan } from "../../../../utilities/_module-exports.js";
import { type IDeinitizable, type IInitizable } from "../../../../utilities/_module-exports.js";
import { type ILockAdapter, type LockRefreshResult } from "../../../../lock/contracts/_module-exports.js";
import type { CollectionOptions, Db } from "mongodb";
import type { ObjectId } from "mongodb";
/**
 *
 * IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
 * @group Adapters
 */
export type MongodbLockAdapterSettings = {
    database: Db;
    /**
     * @default "lock"
     */
    collectionName?: string;
    collectionSettings?: CollectionOptions;
};
/**
 *
 * IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
 * @group Adapters
 */
export type MongodbLockDocument = {
    _id: ObjectId;
    key: string;
    owner: string;
    expiration: Date | null;
};
/**
 * To utilize the `MongodbLockAdapter`, you must install the [`"mongodb"`](https://www.npmjs.com/package/mongodb) package.
 *
 * Note in order to use `MongodbLockAdapter` correctly, ensure you use a single, consistent database across all server instances.
 *
 * IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
 * @group Adapters
 */
export declare class MongodbLockAdapter implements ILockAdapter, IDeinitizable, IInitizable {
    private readonly database;
    private readonly collection;
    private readonly collectionName;
    /**
     * @example
     * ```ts
     * import { MongodbLockAdapter } from "@daiso-tech/core/lock/adapters";
     * import { MongoClient } from "mongodb";
     *
     * const client = await MongoClient.connect("YOUR_MONGODB_CONNECTION_STRING");
     * const database = client.db("database");
     * const lockAdapter = new MongodbLockAdapter({
     *   database
     * });
     * // You need initialize the adapter once before using it.
     * await lockAdapter.init()
     * ```
     */
    constructor(settings: MongodbLockAdapterSettings);
    /**
     * Creates all related indexes.
     * Note the `init` method needs to be called before using the adapter.
     */
    init(): Promise<void>;
    /**
     * Removes the collection where the lock keys are stored and all it's related indexes.
     * Note all lock data will be removed.
     */
    deInit(): Promise<void>;
    acquire(key: string, owner: string, ttl: TimeSpan | null): Promise<boolean>;
    release(key: string, owner: string): Promise<boolean>;
    forceRelease(key: string): Promise<boolean>;
    refresh(key: string, owner: string, ttl: TimeSpan): Promise<LockRefreshResult>;
}
