/**
 * Copyright 2025, Optimizely
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { Transformer } from '../../utils/type';
import { Maybe } from '../../utils/type';
import { OpType, OpValue } from '../../utils/type';
import { Platform } from '../../platform_support';
export interface OpStore<OP extends OpType, V> {
    operation: OP;
    set(key: string, value: V): OpValue<OP, unknown>;
    get(key: string): OpValue<OP, Maybe<V>>;
    remove(key: string): OpValue<OP, unknown>;
    getKeys(): OpValue<OP, string[]>;
}
export type SyncStore<V> = OpStore<'sync', V>;
export type AsyncStore<V> = OpStore<'async', V>;
export type Store<V> = SyncStore<V> | AsyncStore<V>;
export declare abstract class SyncStoreWithBatchedGet<V> implements SyncStore<V> {
    operation: "sync";
    abstract set(key: string, value: V): unknown;
    abstract get(key: string): Maybe<V>;
    abstract remove(key: string): unknown;
    abstract getKeys(): string[];
    abstract getBatched(keys: string[]): Maybe<V>[];
}
export declare abstract class AsyncStoreWithBatchedGet<V> implements AsyncStore<V> {
    operation: "async";
    abstract set(key: string, value: V): Promise<unknown>;
    abstract get(key: string): Promise<Maybe<V>>;
    abstract remove(key: string): Promise<unknown>;
    abstract getKeys(): Promise<string[]>;
    abstract getBatched(keys: string[]): Promise<Maybe<V>[]>;
}
export type StoreWithBatchedGet<V> = SyncStoreWithBatchedGet<V> | AsyncStoreWithBatchedGet<V>;
export declare const getBatchedSync: <V>(store: SyncStore<V>, keys: string[]) => Maybe<V>[];
export declare const getBatchedAsync: <V>(store: AsyncStore<V>, keys: string[]) => Promise<Maybe<V>[]>;
export declare class SyncPrefixStore<U, V> extends SyncStoreWithBatchedGet<V> implements SyncStore<V> {
    private store;
    private prefix;
    private transformGet;
    private transformSet;
    readonly operation = "sync";
    constructor(store: SyncStore<U>, prefix: string, transformGet: Transformer<U, V>, transformSet: Transformer<V, U>);
    private addPrefix;
    private removePrefix;
    set(key: string, value: V): unknown;
    get(key: string): V | undefined;
    remove(key: string): unknown;
    private getInternalKeys;
    getKeys(): string[];
    getBatched(keys: string[]): Maybe<V>[];
}
export declare class AsyncPrefixStore<U, V> implements AsyncStore<V> {
    private cache;
    private prefix;
    private transformGet;
    private transformSet;
    readonly operation = "async";
    constructor(cache: AsyncStore<U>, prefix: string, transformGet: Transformer<U, V>, transformSet: Transformer<V, U>);
    private addPrefix;
    private removePrefix;
    set(key: string, value: V): Promise<unknown>;
    get(key: string): Promise<V | undefined>;
    remove(key: string): Promise<unknown>;
    private getInternalKeys;
    getKeys(): Promise<string[]>;
    getBatched(keys: string[]): Promise<Maybe<V>[]>;
}
export declare const __platforms: Platform[];
