// Auto-generated by scripts/gen_parity_tests.py from docs/runtime-parity.md.
// Module: node:diagnostics_channel
// This file is a byte-for-byte parity test against `node --experimental-strip-types`.
// Edit the TODO lines below to exercise each API; rerun
// `./run_parity_tests.sh --filter test_parity_diagnostics_channel` to verify.

import * as diagnostics_channel from "node:diagnostics_channel";


// ── Module-Level Functions ──
// diagnostics_channel.hasSubscribers(name)
try {
  console.log("diagnostics_channel.hasSubscribers('unsubscribed-name'):", diagnostics_channel.hasSubscribers("unsubscribed-name"));
} catch (e: any) { console.log("diagnostics_channel.hasSubscribers ERR:", e && e.message); }

// diagnostics_channel.channel(name)
try {
  const ch = diagnostics_channel.channel("test");
  console.log("diagnostics_channel.channel('test').name:", ch.name);
  console.log("diagnostics_channel.channel('test').hasSubscribers:", ch.hasSubscribers);
} catch (e: any) { console.log("diagnostics_channel.channel ERR:", e && e.message); }

// diagnostics_channel.subscribe(name, onMessage) + unsubscribe + publish round-trip
try {
  const seen: any[] = [];
  const cb = (msg: any, _name: any) => { seen.push(msg); };
  diagnostics_channel.subscribe("test-sub", cb);
  console.log("diagnostics_channel.hasSubscribers('test-sub') after sub:", diagnostics_channel.hasSubscribers("test-sub"));
  const ch = diagnostics_channel.channel("test-sub");
  ch.publish({ value: 42 });
  console.log("diagnostics_channel subscriber received:", seen.length, "first.value:", (seen[0] as any).value);
  diagnostics_channel.unsubscribe("test-sub", cb);
  console.log("diagnostics_channel.hasSubscribers('test-sub') after unsub:", diagnostics_channel.hasSubscribers("test-sub"));
} catch (e: any) { console.log("diagnostics_channel.subscribe ERR:", e && e.message); }

// diagnostics_channel.tracingChannel(nameOrChannels)
try {
  const tc = diagnostics_channel.tracingChannel("parity-trace");
  console.log("diagnostics_channel.tracingChannel typeof:", typeof tc);
  console.log("diagnostics_channel.tracingChannel.hasSubscribers:", tc.hasSubscribers);
} catch (e: any) { console.log("diagnostics_channel.tracingChannel ERR:", e && e.message); }

// diagnostics_channel.boundedChannel(nameOrChannels) — type probe (v26.1.0)
try {
  console.log("diagnostics_channel.boundedChannel typeof:", typeof (diagnostics_channel as any).boundedChannel);
} catch (e: any) { console.log("diagnostics_channel.boundedChannel ERR:", e && e.message); }

// ── Class: Channel ──
// channel.hasSubscribers / channel.publish / channel.subscribe / channel.unsubscribe
try {
  const ch = diagnostics_channel.channel("channel-class");
  console.log("Channel.hasSubscribers (none):", ch.hasSubscribers);
  let count = 0;
  const onMessage = (_msg: any) => { count++; };
  ch.subscribe(onMessage);
  console.log("Channel.hasSubscribers (one):", ch.hasSubscribers);
  ch.publish("first");
  ch.publish("second");
  console.log("Channel.publish count:", count);
  ch.unsubscribe(onMessage);
  console.log("Channel.hasSubscribers (zero):", ch.hasSubscribers);
} catch (e: any) { console.log("Channel ERR:", e && e.message); }

// channel.bindStore / channel.unbindStore / channel.runStores — type probes (require AsyncLocalStorage)
try {
  const ch = diagnostics_channel.channel("channel-store");
  console.log("Channel.bindStore typeof:", typeof ch.bindStore);
  console.log("Channel.unbindStore typeof:", typeof ch.unbindStore);
  console.log("Channel.runStores typeof:", typeof ch.runStores);
} catch (e: any) { console.log("Channel store API ERR:", e && e.message); }

// channel.withStoreScope — type probe (v26.1.0)
try {
  const ch = diagnostics_channel.channel("channel-withscope");
  console.log("Channel.withStoreScope typeof:", typeof (ch as any).withStoreScope);
} catch (e: any) { console.log("Channel.withStoreScope ERR:", e && e.message); }

// ── Class: TracingChannel ──
try {
  const tc = diagnostics_channel.tracingChannel("trace-class");
  console.log("TracingChannel.subscribe typeof:", typeof tc.subscribe);
  console.log("TracingChannel.unsubscribe typeof:", typeof tc.unsubscribe);
  console.log("TracingChannel.traceSync typeof:", typeof tc.traceSync);
  console.log("TracingChannel.tracePromise typeof:", typeof tc.tracePromise);
  console.log("TracingChannel.traceCallback typeof:", typeof tc.traceCallback);
  console.log("TracingChannel.hasSubscribers:", tc.hasSubscribers);
} catch (e: any) { console.log("TracingChannel ERR:", e && e.message); }

// ── Class: BoundedChannel (v26.1.0) ──
// PERRY-SKIP: boundedChannel API — v26.1.0 experimental, surface still in flux.

// ── TracingChannel Subscriber Hooks ──
// PERRY-SKIP: subscriber hook keys (start / end / asyncStart / asyncEnd / error)
//   exercised via tracingChannel.subscribe(hooks); covered by typeof probes above.

// Coverage: 0 auto-emitted, 30 TODO, 0 skip-listed.
