/**
 * One row per cert-bearing host or wildcard; tracks domain verification and TLS provisioning independently of services_public.domains. Reconcilers match a route's root domain to a row here by string (no FK/coupling in v1)
 * @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 { managedDomainKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const managedDomainQueryKey = managedDomainKeys.detail;
export function useManagedDomainQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: managedDomainKeys.detail(params.id),
        queryFn: () => getClient()
            .managedDomain.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchManagedDomainQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .managedDomain.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchManagedDomainQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: managedDomainKeys.detail(params.id),
        queryFn: () => getClient()
            .managedDomain.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
