/**
 * Invitation records sent to prospective members via email, with token-based redemption and expiration
 * @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 { appInviteKeys } from '../query-keys';
import { appInviteMutationKeys } from '../mutation-keys';
export function useUpdateAppInviteMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: appInviteMutationKeys.all,
        mutationFn: ({ id, appInvitePatch }) => getClient()
            .appInvite.update({
            where: {
                id,
            },
            data: appInvitePatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: appInviteKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: appInviteKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
