/**
 * SEO and social sharing metadata for a site: page title, description, and Open Graph image
 * @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 { siteMetadatumKeys } from '../query-keys';
import { siteMetadatumMutationKeys } from '../mutation-keys';
export function useUpdateSiteMetadatumMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: siteMetadatumMutationKeys.all,
        mutationFn: ({ id, siteMetadatumPatch, }) => getClient()
            .siteMetadatum.update({
            where: {
                id,
            },
            data: siteMetadatumPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: siteMetadatumKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: siteMetadatumKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
