/**
 * Per-database and per-API CORS origin configuration; typed replacement for api_modules cors JSONB entries
 * @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 { corsSettingKeys } from '../query-keys';
import { corsSettingMutationKeys } from '../mutation-keys';
export function useDeleteCorsSettingMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: corsSettingMutationKeys.all,
        mutationFn: ({ id }) => getClient()
            .corsSetting.delete({
            where: {
                id,
            },
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.removeQueries({
                queryKey: corsSettingKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: corsSettingKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
