import { StoreApi } from "zustand";
import { Action, AnyState, DispatchFunc, ExtractState, Handlers, ReadonlyStoreApi } from "@zubridge/types";
export * from "@zubridge/types";

//#region src/renderer/actionValidator.d.ts
/**
 * Register an action type with the state keys it affects
 * @param actionType The action type string
 * @param stateKeys Array of state keys this action affects
 */
declare function registerActionMapping(actionType: string, stateKeys: string[]): void;
/**
 * Register multiple action mappings at once
 * @param mappings Object mapping action types to arrays of state keys
 */
declare function registerActionMappings(mappings: Record<string, string[]>): void;
/**
 * Get the state keys affected by an action
 * @param actionType The action type string
 * @returns Array of state keys this action affects, or empty array if unknown
 */
declare function getAffectedStateKeys(actionType: string): string[];
/**
 * Check if a window can dispatch an action based on its subscriptions
 * @param action The action to validate
 * @returns Promise resolving to boolean indicating if dispatch is allowed
 */
declare function canDispatchAction(action: Action): Promise<boolean>;
/**
 * Validate that a window can dispatch an action, throwing if not allowed
 * @param action The action to validate
 * @throws Error if the window cannot dispatch this action
 */
declare function validateActionDispatch(action: Action): Promise<void>;
//#endregion
//#region src/renderer/subscriptionValidator.d.ts
/**
 * Gets the current window's subscriptions from the main process
 * @returns Array of state keys this window is subscribed to, or empty array if none
 */
declare function getWindowSubscriptions(): Promise<string[]>;
/**
 * Determines if the window is subscribed to a particular state key
 * @param key The state key to check
 * @returns True if subscribed, false otherwise
 */
declare function isSubscribedToKey(key: string): Promise<boolean>;
/**
 * Validates that the window has access to the specified state key
 * Throws an error if the window is not subscribed to the key
 * @param key The state key to validate
 * @param action Optional action to check for bypass flags
 * @throws Error if window is not subscribed to the key and not bypassing
 */
declare function validateStateAccess(key: string, action?: Action): Promise<void>;
/**
 * Checks if a state key exists in the provided state object
 * @param state The state object to check
 * @param key The key to look for (can use dot notation)
 * @returns True if the key exists, false otherwise
 */
declare function stateKeyExists(state: Record<string, unknown>, key: string): boolean;
/**
 * Validates state access with additional check for key existence
 * @param state The state object
 * @param key The key to validate
 * @param action Optional action to check for bypass flags
 * @throws Error if the key doesn't exist or the window isn't subscribed
 */
declare function validateStateAccessWithExistence(state: Record<string, unknown>, key: string, action?: Action): Promise<void>;
//#endregion
//#region src/utils/environment.d.ts
/**
 * Determines if the application is running in development mode
 *
 * Uses a combination of checks to ensure consistent behavior:
 * 1. Checks if app is packaged (production builds are packaged)
 * 2. Checks NODE_ENV environment variable
 * 3. Checks ELECTRON_IS_DEV environment variable (set by electron-is-dev or similar utilities)
 *
 * @returns {boolean} True if running in development mode, false otherwise
 */
declare const isDev: () => Promise<boolean>;
//#endregion
//#region src/index.d.ts
type UseBoundStore<S extends ReadonlyStoreApi<unknown>> = {
  (): ExtractState<S>;
  <U>(selector: (state: ExtractState<S>) => U): U;
} & S;
declare const createHandlers: <S extends AnyState>() => Handlers<S>;
/**
 * Creates a hook for accessing the store state in renderer components
 */
declare const createUseStore: <S extends AnyState>(customHandlers?: Handlers<S>) => UseBoundStore<StoreApi<S>>;
/**
 * Creates a dispatch function for use in renderer components
 */
declare function useDispatch<S extends AnyState = AnyState, TActions extends Record<string, unknown> = Record<string, unknown>>(customHandlers?: Handlers<S>): DispatchFunc<S, TActions>;
//#endregion
export { canDispatchAction, createHandlers, createUseStore, getAffectedStateKeys, getWindowSubscriptions, isDev, isSubscribedToKey, registerActionMapping, registerActionMappings, stateKeyExists, useDispatch, validateActionDispatch, validateStateAccess, validateStateAccessWithExistence };