import { StepId } from '../../domain/value-objects/StepId';
import {
  NavigationResult,
  FormFillResult,
  ClickResult,
  WaitResult,
  ModalResult,
  AutomationResult,
} from './AutomationResults';

export interface IBrowserAutomation {
  navigateToPage(url: string): Promise<NavigationResult>;
  fillFormField(fieldName: string, value: string): Promise<FormFillResult>;
  clickElement(selector: string): Promise<ClickResult>;
  waitForElement(selector: string, maxWaitMs?: number): Promise<WaitResult>;
  handleModal(stepId: StepId, action: string): Promise<ModalResult>;

  /**
   * Execute a complete workflow step with all required browser operations.
   * Uses IRacingSelectorMap to locate elements and performs appropriate actions.
   *
   * @param stepId - The step to execute (1-18)
   * @param config - Session configuration with form field values
   * @returns AutomationResult with success/failure and metadata
   */
  executeStep?(stepId: StepId, config: Record<string, unknown>): Promise<AutomationResult>;

  connect?(): Promise<void>;
  disconnect?(): Promise<void>;
  isConnected?(): boolean;
}