import type { CliArgs } from '../../cli/args';

export function createBuildHandleInitialArgsMainDepsHandler(deps: {
  getInitialArgs: () => CliArgs | null;
  isBackgroundMode: () => boolean;
  shouldEnsureTrayOnStartup: () => boolean;
  shouldRunHeadlessInitialCommand: (args: CliArgs) => boolean;
  ensureTray: () => void;
  isTexthookerOnlyMode: () => boolean;
  hasImmersionTracker: () => boolean;
  getMpvClient: () => { connected: boolean; connect: () => void } | null;
  commandNeedsOverlayStartupPrereqs: (args: CliArgs) => boolean;
  commandNeedsOverlayRuntime: (args: CliArgs) => boolean;
  ensureOverlayStartupPrereqs: () => void;
  isOverlayRuntimeInitialized: () => boolean;
  initializeOverlayRuntime: () => void;
  logInfo: (message: string) => void;
  handleCliCommand: (args: CliArgs, source: 'initial') => void;
}) {
  return () => ({
    getInitialArgs: () => deps.getInitialArgs(),
    isBackgroundMode: () => deps.isBackgroundMode(),
    shouldEnsureTrayOnStartup: () => deps.shouldEnsureTrayOnStartup(),
    shouldRunHeadlessInitialCommand: (args: CliArgs) => deps.shouldRunHeadlessInitialCommand(args),
    ensureTray: () => deps.ensureTray(),
    isTexthookerOnlyMode: () => deps.isTexthookerOnlyMode(),
    hasImmersionTracker: () => deps.hasImmersionTracker(),
    getMpvClient: () => deps.getMpvClient(),
    commandNeedsOverlayStartupPrereqs: (args: CliArgs) =>
      deps.commandNeedsOverlayStartupPrereqs(args),
    commandNeedsOverlayRuntime: (args: CliArgs) => deps.commandNeedsOverlayRuntime(args),
    ensureOverlayStartupPrereqs: () => deps.ensureOverlayStartupPrereqs(),
    isOverlayRuntimeInitialized: () => deps.isOverlayRuntimeInitialized(),
    initializeOverlayRuntime: () => deps.initializeOverlayRuntime(),
    logInfo: (message: string) => deps.logInfo(message),
    handleCliCommand: (args: CliArgs, source: 'initial') => deps.handleCliCommand(args, source),
  });
}
