/**
 * Top-level AI/LLM conversation. Owns the chat-mode + model + system-prompt snapshot for the lifetime of the conversation, and is the entity-scoping anchor — descendants (agent_message, agent_task) inherit entity_id from this row via DataInheritFromParent. RLS is owner-only (AuthzDirectOwner); entity_id is a grouping dimension, not a security dimension.
 * @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 { agentThreadKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const agentThreadQueryKey = agentThreadKeys.detail;
export function useAgentThreadQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: agentThreadKeys.detail(params.id),
        queryFn: () => getClient()
            .agentThread.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchAgentThreadQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .agentThread.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchAgentThreadQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: agentThreadKeys.detail(params.id),
        queryFn: () => getClient()
            .agentThread.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
