import { StorageType, BroadcastStrategy } from './enums'; /** * Listener function type for store state changes. * @template T - The type of the store state. * @param {T} state - The new state after an update. */ export type Listener = (state: T) => void; /** * Middleware function type for intercepting state changes. * @template T - The type of the store state. * @param {{ name: string; state: T }} payload - Store name and current state. */ export type Middleware = (payload: { name: string; state: T }) => void; /** * Interface representing a generic store. * @template T - The type of the store state. */ export interface Store { /** * Get the current state. * @returns {T} The current state. */ get(): T; /** * Update the state with a partial update. * @param {Partial} update - The partial state to merge. */ set(update: Partial): void; /** * Subscribe to state changes. * @param {Listener} listener - The listener function. * @returns {() => void} Unsubscribe function. */ on(listener: Listener): () => void; } /** * Options for store creation. */ export interface StoreOptions { broadcast?: BroadcastStrategy; persist?: boolean; storageType?: StorageType; enableEncryption?: boolean; // Enable encryption encryptionKey?: string; // Secret key for encryption }