declare module '@inertiajs/react' {
    import { ComponentType, ReactNode } from 'react';

    export interface PageProps {
        [key: string]: any;
    }

    export function usePage<T = PageProps>(): { props: T; url: string; component: string; version: string | null; scrollRegions: { top: number; left: number }[]; rememberedState: Record<string, unknown>; resolvedErrors: Record<string, string> };

    export function useForm<TForm extends Record<string, any>>(initialValues: TForm): {
        data: TForm;
        setData: {
            <K extends keyof TForm>(key: K, value: TForm[K]): void;
            (values: TForm): void;
        };
        post: (url: string, options?: any) => void;
        put: (url: string, options?: any) => void;
        patch: (url: string, options?: any) => void;
        delete: (url: string, options?: any) => void;
        get: (url: string, options?: any) => void;
        processing: boolean;
        progress: { percentage: number } | null;
        errors: Partial<Record<keyof TForm, string>>;
        reset: (...fields: (keyof TForm)[]) => void;
        clearErrors: (...fields: (keyof TForm)[]) => void;
        transform: (callback: (data: TForm) => any) => void;
        isDirty: boolean;
        recentlySuccessful: boolean;
        wasSuccessful: boolean;
    };

    export function useRemember<T>(initialValue: T, key?: string): [T, (value: T) => void];

    export const router: {
        visit: (url: string, options?: any) => void;
        get: (url: string, data?: any, options?: any) => void;
        post: (url: string, data?: any, options?: any) => void;
        put: (url: string, data?: any, options?: any) => void;
        patch: (url: string, data?: any, options?: any) => void;
        delete: (url: string, options?: any) => void;
        reload: (options?: any) => void;
        replace: (url: string, options?: any) => void;
        on: (event: string, callback: (event: any) => void) => () => void;
    };

    export interface HeadProps {
        title?: string;
        children?: ReactNode;
    }
    export const Head: ComponentType<HeadProps>;

    export interface LinkProps {
        href: string;
        method?: 'get' | 'post' | 'put' | 'patch' | 'delete';
        data?: Record<string, any>;
        as?: string;
        replace?: boolean;
        preserveScroll?: boolean;
        preserveState?: boolean;
        only?: string[];
        headers?: Record<string, string>;
        onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
        onCancelToken?: (cancelToken: any) => void;
        onBefore?: () => void;
        onStart?: () => void;
        onProgress?: (progress: any) => void;
        onFinish?: () => void;
        onCancel?: () => void;
        onSuccess?: () => void;
        onError?: (errors: any) => void;
        className?: string;
        children?: ReactNode;
        [key: string]: any;
    }
    export const Link: ComponentType<LinkProps>;

    export interface InertiaAppProps {
        initialPage: any;
        initialComponent?: any;
        resolveComponent: (name: string) => Promise<any> | any;
        titleCallback?: (title: string) => string;
        onHeadUpdate?: (elements: any[]) => void;
    }

    export function createInertiaApp(options: {
        id?: string;
        resolve: (name: string) => Promise<any> | any;
        setup: (options: { el: Element; App: ComponentType; props: any }) => void;
        title?: (title: string) => string;
        progress?: {
            delay?: number;
            color?: string;
            includeCSS?: boolean;
            showSpinner?: boolean;
        } | false;
        page?: any;
        render?: (app: ReactNode) => string | Promise<string>;
    }): Promise<{ head: string[]; body: string } | void>;
}
