/**
 * 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 { useQuery } from '@tanstack/react-query';
import { getClient } from '../client';
import { buildSelectionArgs } from '../selection';
import { siteMetadatumKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const siteMetadatumQueryKey = siteMetadatumKeys.detail;
export function useSiteMetadatumQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: siteMetadatumKeys.detail(params.id),
        queryFn: () => getClient()
            .siteMetadatum.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchSiteMetadatumQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .siteMetadatum.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchSiteMetadatumQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: siteMetadatumKeys.detail(params.id),
        queryFn: () => getClient()
            .siteMetadatum.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
