/**
 * Sandboxed Lua Engine Types
 * Shared interface to avoid circular dependencies
 */

import type { LuaEngine } from '../../LuaEngine'
import type { LuaExecutionContext, LuaExecutionResult } from '../types'

/**
 * Interface representing the sandboxed Lua engine state
 * Used to avoid circular dependencies in sandbox method files
 */
export interface SandboxedLuaEngineState {
  /** The underlying Lua engine */
  engine: LuaEngine | null
  /** Execution timeout in milliseconds */
  executionTimeout: number
  /** Maximum memory allowed */
  maxMemory: number
  /** Allowed global names for sandbox */
  allowedGlobals?: string[]
  /** Set allowed global names for sandbox */
  setAllowedGlobals: (allowedGlobals?: string[]) => void
  /** Disable dangerous Lua functions */
  disableDangerousFunctions: () => void
  /** Setup sandboxed environment */
  setupSandboxedEnvironment: (allowedGlobals?: string[]) => void
  /** Execute code with timeout */
  executeWithTimeout: (code: string, context?: LuaExecutionContext) => Promise<LuaExecutionResult>
  /** Read current Lua heap usage in bytes */
  getLuaMemoryUsageBytes: () => number
  /** Enforce maxMemory threshold */
  enforceMaxMemory: () => void
}
