/**
 * Compose the canonical `/docs/`-relative path for a context-doc reference.
 *
 * Single source of truth across producers (eval doc fetcher, repo-task
 * mirroring) and consumers (dashboard projections). Resolution order:
 *
 * 1. An explicit `path` (e.g. authored on a YAML/repo-mirrored task) wins.
 * 2. Otherwise compose `sectionSlug + "/" + slug` when both are present.
 * 3. Otherwise `null` — neither caller can build a working docs URL, so
 *    consumers should disable the link rather than emit a 404.
 *
 * The leaf `slug` alone is never returned as the path because
 * `article.slug.current` is leaf-only on sanity.io/docs; the hierarchy
 * lives on `primarySection->slug.current`.
 */
export function buildContextDocPath(input) {
    if (input.path)
        return input.path;
    if (input.sectionSlug && input.slug) {
        return `${input.sectionSlug}/${input.slug}`;
    }
    return null;
}
