/**
 * Organizational chart edges defining parent-child reporting relationships between members within an entity
 * @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 { orgChartEdgeKeys } from '../query-keys';
import { orgChartEdgeMutationKeys } from '../mutation-keys';
export function useUpdateOrgChartEdgeMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: orgChartEdgeMutationKeys.all,
        mutationFn: ({ id, orgChartEdgePatch }) => getClient()
            .orgChartEdge.update({
            where: {
                id,
            },
            data: orgChartEdgePatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: orgChartEdgeKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: orgChartEdgeKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
