#!/usr/bin/env ts-node
/**
 * Generate the API search-parameter coverage doc from the registry.
 *
 * Run from the constructs package:
 *   pnpm --filter @openhi/constructs exec ts-node scripts/generate-search-coverage.ts
 *
 * Output is committed (this repo's generated-files convention: generate
 * locally, commit the result). `search-coverage-doc.test.ts` fails if the
 * committed file drifts from the registry, so staleness can't merge silently
 * — no bespoke CI gate needed.
 */
import { writeFileSync } from "node:fs";
import { resolve } from "node:path";
import { renderSearchCoverageDoc } from "../src/data/search/registry/search-coverage-doc";

const OUTPUT = resolve(
  __dirname,
  "../../../../sites/www-docs/content/api/search-parameters.md",
);

writeFileSync(OUTPUT, renderSearchCoverageDoc(), "utf8");
// eslint-disable-next-line no-console
console.log(`Wrote ${OUTPUT}`);
