import { UseJsonStreamProps, StartStream, StopStream } from '../types/index.mjs';
import z from 'zod';

/**
 * `useJsonStream` is a custom React hook that extends the `useStream` hook to add JSON parsing functionality.
 * It uses the `SchemaStream` to parse the incoming stream into JSON.
 *
 * @param {UseJsonStreamProps} props - The props for the hook include optional callback
 * functions that will be invoked at different stages of the stream lifecycle, and a schema for the JSON data.
 *
 * @returns {
 * startStream: StartStream,
 * stopStream: StopStream,
 * data: Partial<z.infer<T>>,
 * loading: boolean
 * }
 *
 * @example
 * ```
 * const {
 *   loading,
 *   startStream,
 *   stopStream,
 * } = useJsonStream({ onBeforeStart: ..., onReceive: ..., onStop: ..., schema: ... });
 * ```
 */
declare function useJsonStream<T extends z.AnyZodObject>({ onReceive, onEnd, schema, onBeforeStart, onStop, defaultData }: UseJsonStreamProps<T>): {
    startStream: StartStream;
    stopStream: StopStream;
    data: Partial<z.infer<T>>;
    loading: boolean;
};

export { useJsonStream };
