import type { AnalyticsAdapter, AnalyticsProps } from "../types.js";
import { emitEvent } from "../sink.js";

export class MetricaAdapter implements AnalyticsAdapter {
  readonly name = "metrica" as const;

  async load(): Promise<void> {
    // Stub: real Yandex.Metrica script loads in Phase 2A (after A7 resolves)
  }

  track(event: string, props: AnalyticsProps = {}): void {
    emitEvent({ kind: "track", name: event, props, provider: this.name, ts: new Date().toISOString() });
  }

  page(url: string, props: AnalyticsProps = {}): void {
    emitEvent({ kind: "page", name: url, props, provider: this.name, ts: new Date().toISOString() });
  }
}
