/**
 * @module Lock
 */
import type { TimeSpan } from "../../../../utilities/_module-exports.js";
import { type Key, type AsyncLazy, type OneOrMore, type Result } from "../../../../utilities/_module-exports.js";
import { KeyAlreadyAcquiredLockError, type AquireBlockingSettings, type LockEventMap } from "../../../../lock/contracts/_module-exports.js";
import { type ILock, type ILockAdapter } from "../../../../lock/contracts/_module-exports.js";
import { LazyPromise } from "../../../../async/_module-exports.js";
import type { IEventDispatcher } from "../../../../event-bus/contracts/_module-exports.js";
import type { LockState } from "../../../../lock/implementations/derivables/lock-provider/lock-state.js";
/**
 * @internal
 */
export type ISerializedLock = {
    key: OneOrMore<string>;
    owner: string;
    ttlInMs: number | null;
    expirationInMs: number | null;
};
/**
 * @internal
 */
export type LockSettings = {
    createLazyPromise: <TValue = void>(asyncFn: () => PromiseLike<TValue>) => LazyPromise<TValue>;
    serdeTransformerName: string;
    adapter: ILockAdapter;
    lockState: LockState;
    eventDispatcher: IEventDispatcher<LockEventMap>;
    key: Key;
    owner: OneOrMore<string>;
    ttl: TimeSpan | null;
    expirationInMs: number | null;
    defaultBlockingInterval: TimeSpan;
    defaultBlockingTime: TimeSpan;
    defaultRefreshTime: TimeSpan;
};
/**
 * @internal
 */
export declare class Lock implements ILock {
    /**
     * @internal
     */
    static serialize(deserializedValue: Lock): ISerializedLock;
    private readonly createLazyPromise;
    private readonly adapter;
    private readonly lockState;
    private readonly eventDispatcher;
    private readonly key;
    private readonly owner;
    private readonly ttl;
    private readonly defaultBlockingInterval;
    private readonly defaultBlockingTime;
    private readonly defaultRefreshTime;
    private readonly serdeTransformerName;
    /**
     * @internal
     */
    constructor(settings: LockSettings);
    getSerdeTransformerName(): string;
    run<TValue = void>(asyncFn: AsyncLazy<TValue>): LazyPromise<Result<TValue, KeyAlreadyAcquiredLockError>>;
    runOrFail<TValue = void>(asyncFn: AsyncLazy<TValue>): LazyPromise<TValue>;
    runBlocking<TValue = void>(asyncFn: AsyncLazy<TValue>, settings?: AquireBlockingSettings): LazyPromise<Result<TValue, KeyAlreadyAcquiredLockError>>;
    runBlockingOrFail<TValue = void>(asyncFn: AsyncLazy<TValue>, settings?: AquireBlockingSettings): LazyPromise<TValue>;
    acquire(): LazyPromise<boolean>;
    acquireOrFail(): LazyPromise<void>;
    acquireBlocking(settings?: AquireBlockingSettings): LazyPromise<boolean>;
    acquireBlockingOrFail(settings?: AquireBlockingSettings): LazyPromise<void>;
    release(): LazyPromise<boolean>;
    releaseOrFail(): LazyPromise<void>;
    forceRelease(): LazyPromise<void>;
    isExpired(): LazyPromise<boolean>;
    isLocked(): LazyPromise<boolean>;
    refresh(ttl?: TimeSpan): LazyPromise<boolean>;
    refreshOrFail(ttl?: TimeSpan): LazyPromise<void>;
    getRemainingTime(): LazyPromise<TimeSpan | null>;
    getOwner(): LazyPromise<string>;
}
