/**
 * 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 { useMutation, useQueryClient } from '@tanstack/react-query';
import { getClient } from '../client';
import { buildSelectionArgs } from '../selection';
import { managedDomainKeys } from '../query-keys';
import { managedDomainMutationKeys } from '../mutation-keys';
export function useCreateManagedDomainMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: managedDomainMutationKeys.create(),
        mutationFn: (data) => getClient()
            .managedDomain.create({
            data,
            select: args.select,
        })
            .unwrap(),
        onSuccess: () => {
            queryClient.invalidateQueries({
                queryKey: managedDomainKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
