/**
 * Mobile and native app configuration linked to a site, including store links and identifiers
 * @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 { appKeys } from '../query-keys';
import { appMutationKeys } from '../mutation-keys';
export function useDeleteAppMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: appMutationKeys.all,
        mutationFn: ({ id }) => getClient()
            .app.delete({
            where: {
                id,
            },
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.removeQueries({
                queryKey: appKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: appKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
