/**
 * Copyright (c) OpenLens Maintainers. All rights reserved.
 * Licensed under MIT License. See LICENSE in root directory for more information.
 */
import type { Draft } from "immer";
import type { Logger } from "@openlens/logger";
export interface StorageChange<T> {
    key: string;
    value: T | undefined;
    oldValue: T | undefined;
}
export interface StorageAdapter<T> {
    [metadata: string]: unknown;
    getItem(key: string): T;
    setItem(key: string, value: T): void;
    removeItem(key: string): void;
    onChange?(change: StorageChange<T>): void;
}
export interface StorageHelperOptions<T> {
    readonly storage: StorageAdapter<T>;
    readonly defaultValue: T;
}
export interface StorageLayer<T> {
    isDefaultValue(val: T): boolean;
    get(): T;
    set(value: T): void;
    reset(): void;
    merge(value: Partial<T> | ((draft: Draft<T>) => Partial<T> | void)): void;
}
export declare const storageHelperLogPrefix = "[STORAGE-HELPER]:";
export interface StorageHelperDependencies {
    readonly logger: Logger;
}
export declare class StorageHelper<T> implements StorageLayer<T> {
    private readonly dependencies;
    readonly key: string;
    private readonly options;
    readonly storage: StorageAdapter<T>;
    private readonly data;
    private readonly value;
    get defaultValue(): T;
    constructor(dependencies: StorageHelperDependencies, key: string, options: StorageHelperOptions<T>);
    isDefaultValue(value: T): boolean;
    private onChange;
    get(): T;
    set(value: T): void;
    reset(): void;
    merge(value: T extends object ? Partial<T> | ((draft: Draft<T>) => Partial<T> | void) : never): void;
}
