/**
 * Message within an agent thread with TextPart/ToolPart jsonb parts
 * @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 { agentMessageKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const agentMessageQueryKey = agentMessageKeys.detail;
export function useAgentMessageQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: agentMessageKeys.detail(params.id),
        queryFn: () => getClient()
            .agentMessage.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchAgentMessageQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .agentMessage.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchAgentMessageQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: agentMessageKeys.detail(params.id),
        queryFn: () => getClient()
            .agentMessage.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
