/**
 * URL ↔ Variables Converter for URL State Management
 *
 * Bidirectional conversion between URL parameters and GraphQL variables.
 * Handles type coercion, nested paths, and array parameters.
 */
import { FlattenedParam } from './flatten-schema';
import { JSType } from './graphql-parser';
/**
 * Convert URL search params to GraphQL variables
 *
 * Reads URL parameters and reconstructs the nested GraphQL variables object
 * based on the flattened schema mapping.
 *
 * @param searchParams - URLSearchParams from window.location or Next.js
 * @param schema - Flattened parameter schema
 * @returns GraphQL variables object ready for Apollo Client
 *
 * @example
 * URL: ?search=error&severity=critical&severity=error&cursor=abc
 * Schema: {
 *   search: { graphqlPath: 'search', type: 'string' },
 *   severity: { graphqlPath: 'filter.severity', type: 'array' },
 *   cursor: { graphqlPath: 'cursor', type: 'string' }
 * }
 * Result: {
 *   search: 'error',
 *   filter: { severity: ['critical', 'error'] },
 *   cursor: 'abc'
 * }
 */
export declare function urlParamsToVariables(searchParams: URLSearchParams, schema: Record<string, FlattenedParam>): Record<string, any>;
/**
 * Convert GraphQL variables to URL search params
 *
 * Flattens nested GraphQL variables to URL parameters based on schema mapping.
 * Excludes null/undefined/default values to keep URLs clean.
 *
 * @param variables - GraphQL variables object
 * @param schema - Flattened parameter schema
 * @returns URLSearchParams ready for router.push()
 *
 * @example
 * Variables: {
 *   search: 'error',
 *   filter: { severity: ['critical'], toolType: [] },
 *   cursor: null
 * }
 * Result URL: ?search=error&severity=critical
 * (empty arrays and null values excluded)
 */
export declare function variablesToUrlParams(variables: Record<string, any>, schema: Record<string, FlattenedParam>): URLSearchParams;
/**
 * Coerce URL parameter value to correct JavaScript type
 *
 * @param value - Raw value from URLSearchParams (string or string[])
 * @param type - Target JavaScript type
 * @returns Coerced value
 */
export declare function coerceValue(value: string | string[], type: JSType): any;
/**
 * Set value at nested path in object
 *
 * Creates intermediate objects as needed.
 *
 * @param obj - Target object to modify
 * @param path - Dot-separated path (e.g., "filter.severity")
 * @param value - Value to set
 *
 * @example
 * setNestedValue({}, 'filter.severity', ['error'])
 * // Result: { filter: { severity: ['error'] } }
 */
export declare function setNestedValue(obj: any, path: string, value: any): void;
/**
 * Get value from nested path in object
 *
 * Returns undefined if path doesn't exist.
 *
 * @param obj - Source object
 * @param path - Dot-separated path (e.g., "filter.severity")
 * @returns Value at path or undefined
 *
 * @example
 * getNestedValue({ filter: { severity: ['error'] } }, 'filter.severity')
 * // Result: ['error']
 */
export declare function getNestedValue(obj: any, path: string): any;
/**
 * Merge URL parameters into existing variables
 *
 * Useful for updating specific parameters without losing others.
 *
 * @param currentVariables - Current GraphQL variables
 * @param updates - Parameter updates (flat object)
 * @param schema - Flattened parameter schema
 * @returns Updated variables object
 */
export declare function mergeVariables(currentVariables: Record<string, any>, updates: Record<string, any>, schema: Record<string, FlattenedParam>): Record<string, any>;
/**
 * Clear specific parameters from variables
 *
 * @param variables - Current GraphQL variables
 * @param paramNames - Parameter names to clear
 * @param schema - Flattened parameter schema
 * @returns Variables with specified params removed
 */
export declare function clearParams(variables: Record<string, any>, paramNames: string[], schema: Record<string, FlattenedParam>): Record<string, any>;
/**
 * Validate GraphQL variables against schema
 *
 * Checks for required parameters and type consistency.
 *
 * @param variables - GraphQL variables to validate
 * @param schema - Flattened parameter schema
 * @returns Validation errors (empty array if valid)
 */
export declare function validateVariables(variables: Record<string, any>, schema: Record<string, FlattenedParam>): string[];
//# sourceMappingURL=url-converter.d.ts.map