// src/engine/messaging/TopicRouter.ts

export class TopicRouter {
  /** Actor's single inbound topic — all commands, queries, system messages.
   *  Pass `root` for cross-root topics (e.g. subscribing to a foreign realm). */
  static inbox(mount: string, root?: string): string {
    const base = mount ? `${mount}/$inbox` : '$inbox';
    return root ? `${root}/${base}` : base;
  }

  /** Actor's single outbound topic — all emitted events.
   *  Pass `root` for cross-root topics (e.g. subscribing to a foreign realm). */
  static events(mount: string, root?: string): string {
    const base = mount ? `${mount}/$events` : '$events';
    return root ? `${root}/${base}` : base;
  }
}
