/**
 * Global secret name registry — declares which secrets the platform recognizes. Actual values live in app_secrets.
 * @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 { secretDefinitionKeys } from '../query-keys';
import { secretDefinitionMutationKeys } from '../mutation-keys';
export function useUpdateSecretDefinitionMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: secretDefinitionMutationKeys.all,
        mutationFn: ({ id, secretDefinitionPatch, }) => getClient()
            .secretDefinition.update({
            where: {
                id,
            },
            data: secretDefinitionPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: secretDefinitionKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: secretDefinitionKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
