import { Temporal } from "@js-temporal/polyfill";
import { URLPattern } from "urlpattern-polyfill";

//#region federation/kv.d.ts
/**
 * A key for a key–value store.  An array of one or more strings.
 *
 * @since 0.5.0
 */
type KvKey = readonly [string] | readonly [string, ...string[]];
/**
 * Additional options for setting a value in a key–value store.
 *
 * @since 0.5.0
 */
interface KvStoreSetOptions {
  /**
   * The time-to-live (TTL) for the value.
   */
  ttl?: Temporal.Duration;
}
/**
 * An abstract interface for a key–value store.
 *
 * @since 0.5.0
 */
interface KvStore {
  /**
   * Gets the value for the given key.
   * @param key The key to get the value for.
   * @returns The value for the key, or `undefined` if the key does not exist.
   * @typeParam T The type of the value to get.
   */
  get<T = unknown>(key: KvKey): Promise<T | undefined>;
  /**
   * Sets the value for the given key.
   * @param key The key to set the value for.
   * @param value The value to set.
   * @param options Additional options for setting the value.
   */
  set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
  /**
   * Deletes the value for the given key.
   * @param key The key to delete.
   */
  delete(key: KvKey): Promise<void>;
}
/**
 * A key–value store that stores values in memory.
 * Do not use this in production as it does not persist values.
 *
 * @since 0.5.0
 */
declare class MemoryKvStore implements KvStore {
  #private;
  /**
   * {@inheritDoc KvStore.get}
   */
  get<T = unknown>(key: KvKey): Promise<T | undefined>;
  /**
   * {@inheritDoc KvStore.set}
   */
  set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
  /**
   * {@inheritDoc KvStore.delete}
   */
  delete(key: KvKey): Promise<void>;
}
//#endregion
export { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore };