/**
 * Update mutation hook for HttpRouteModule
 * @generated by @constructive-io/graphql-codegen
 * DO NOT EDIT - changes will be overwritten
 */
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { getClient } from '../client';
import { buildSelectionArgs } from '../selection';
import { httpRouteModuleKeys } from '../query-keys';
import { httpRouteModuleMutationKeys } from '../mutation-keys';
export function useUpdateHttpRouteModuleMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: httpRouteModuleMutationKeys.all,
        mutationFn: ({ id, httpRouteModulePatch, }) => getClient()
            .httpRouteModule.update({
            where: {
                id,
            },
            data: httpRouteModulePatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: httpRouteModuleKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: httpRouteModuleKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
