/**
 * A single message in an agent_thread. The full client-rendered content (TextPart and ToolPart, including the ToolPart state machine and inline approval object) lives in the `parts` jsonb column — there is no separate agent_tool_call or agent_tool_approval table in v1. Cascade-deleted with the parent thread; RLS is owner-only.
 * @generated by @constructive-io/graphql-codegen
 * DO NOT EDIT - changes will be overwritten
 */
import { useQuery } from '@tanstack/react-query';
import { getClient } from '../client';
import { buildListSelectionArgs } from '../selection';
import { agentMessageKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const agentMessagesQueryKey = agentMessageKeys.list;
export function useAgentMessagesQuery(params) {
    const args = buildListSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: agentMessageKeys.list(args),
        queryFn: () => getClient().agentMessage.findMany(args).unwrap(),
        ...queryOptions,
    });
}
export async function fetchAgentMessagesQuery(params) {
    const args = buildListSelectionArgs(params.selection);
    return getClient().agentMessage.findMany(args).unwrap();
}
export async function prefetchAgentMessagesQuery(queryClient, params) {
    const args = buildListSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: agentMessageKeys.list(args),
        queryFn: () => getClient().agentMessage.findMany(args).unwrap(),
    });
}
