/**
 * Registry of valid config keys — declares which config entries the platform recognizes
 * @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 { platformConfigDefinitionKeys } from '../query-keys';
import { platformConfigDefinitionMutationKeys } from '../mutation-keys';
export function useUpdatePlatformConfigDefinitionMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: platformConfigDefinitionMutationKeys.all,
        mutationFn: ({ id, platformConfigDefinitionPatch, }) => getClient()
            .platformConfigDefinition.update({
            where: {
                id,
            },
            data: platformConfigDefinitionPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: platformConfigDefinitionKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: platformConfigDefinitionKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
