// src/runtime/IRuntimeConfig.ts

import type { IRuntimeHost } from './IRuntimeHost';
import type { ITransportAdapter } from '../engine/remoting/ITransportAdapter';
import type { IDomStrategy } from './IDomStrategy';
import type { ITopicClaimRegistry } from '../core/security/ITopicClaimRegistry';
import type { ISecurityRealm } from '../core/security/ISecurityRealm';
import type { IRecordStoreProvider } from '../core/IRecordStoreProvider';

export interface IRuntimeConfig {
  /** Transport adapter. If not provided, an InMemoryTransport will be created. */
  transport?: ITransportAdapter;

  /** Optional DOM strategy. null/undefined = headless mode. */
  domStrategy?: IDomStrategy;

  /** @deprecated Use domStrategy instead. Legacy host for backwards compat during migration. */
  host?: IRuntimeHost;

  logging?: boolean;

  /**
   * Allow dynamic component compilation via new Function().
   * SECURITY: Essentially eval(). Set to false in production.
   * @default true (for development/testing backwards compat)
   */
  allowDynamicCompilation?: boolean;

  /**
   * Enable topic claiming for component namespace authority.
   * When enabled, components must claim topic prefixes before creating children.
   * @default false (opt-in for backwards compat)
   */
  enableTopicClaiming?: boolean;

  /** Custom TopicClaimRegistry instance (for testing or advanced use). */
  topicClaimRegistry?: ITopicClaimRegistry;

  /**
   * Security realm for message verification and spawn policy enforcement.
   * When provided, cascades to all actor contexts via MatrixContext inheritance.
   * Enables ActorBehavior message verification and evaluateSpawn checks.
   * @default undefined (no enforcement — actors use per-actor local realms only)
   */
  securityRealm?: ISecurityRealm;

  /**
   * Per-package record-store provider. Registered on the root context under
   * RECORD_STORE_PROVIDER_KEY. PackageRootActor uses it at bootstrap to
   * obtain a per-package store without core depending on any sibling
   * implementation package (e.g., @open-matrix/system-sqlite).
   * @default undefined (no provider — package storage is deferred)
   */
  recordStoreProvider?: IRecordStoreProvider;
}
