/**
 * 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 { orgInviteKeys } from '../query-keys';
import { orgInviteMutationKeys } from '../mutation-keys';
export function useUpdateOrgInviteMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: orgInviteMutationKeys.all,
        mutationFn: ({ id, orgInvitePatch }) => getClient()
            .orgInvite.update({
            where: {
                id,
            },
            data: orgInvitePatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: orgInviteKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: orgInviteKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
