/**
 * E2E Testing Types and Interfaces
 * Core types for terminal UI testing framework
 */
interface TerminalSize {
    cols: number;
    rows: number;
}
interface Point {
    x: number;
    y: number;
}
interface Rectangle {
    x: number;
    y: number;
    width: number;
    height: number;
}
interface MouseButton {
    left: boolean;
    middle: boolean;
    right: boolean;
}
interface KeyModifiers {
    ctrl?: boolean;
    alt?: boolean;
    shift?: boolean;
    meta?: boolean;
}
interface MouseEvent {
    type: 'click' | 'drag' | 'move' | 'scroll' | 'down' | 'up';
    position: Point;
    button?: 'left' | 'middle' | 'right' | 'up' | 'down';
    modifiers?: KeyModifiers;
}
interface KeyEvent {
    key: string;
    modifiers?: KeyModifiers;
}
interface ScreenCapture {
    raw: string;
    text: string;
    lines: string[];
    timestamp: number;
    size: TerminalSize;
}
interface Snapshot {
    id: string;
    name: string;
    capture: ScreenCapture;
    metadata?: Record<string, any>;
}
interface AssertionOptions {
    ignoreWhitespace?: boolean;
    ignoreCase?: boolean;
    ignoreAnsi?: boolean;
    trimLines?: boolean;
    normalizeLineEndings?: boolean;
}
interface WaitOptions {
    timeout?: number;
    interval?: number;
    message?: string;
}
interface TesterConfig {
    command: string[];
    size?: TerminalSize;
    env?: Record<string, string>;
    cwd?: string;
    shell?: string;
    sessionName?: string;
    debug?: boolean;
    recordingEnabled?: boolean;
    snapshotDir?: string;
}
interface Recording {
    startTime: number;
    events: RecordedEvent[];
    captures: ScreenCapture[];
}
interface RecordedEvent {
    timestamp: number;
    type: 'input' | 'output' | 'resize' | 'mouse' | 'key';
    data: any;
}
type Runtime = 'node' | 'deno' | 'bun';
interface RuntimeAdapter {
    exec(command: string): Promise<{
        stdout: string;
        stderr: string;
        code: number;
    }>;
    spawn(command: string, args: string[]): Promise<ChildProcess>;
    sleep(ms: number): Promise<void>;
    readFile(path: string): Promise<string>;
    writeFile(path: string, content: string): Promise<void>;
    exists(path: string): Promise<boolean>;
    mkdir(path: string, options?: {
        recursive?: boolean;
    }): Promise<void>;
    commandExists?(command: string): Promise<boolean>;
    tryExec?(command: string): Promise<{
        stdout: string;
        stderr: string;
        code: number;
    } | null>;
}
interface ChildProcess {
    pid: number;
    kill(signal?: string): void;
    stdin: WritableStream | NodeJS.WritableStream;
    stdout: ReadableStream | NodeJS.ReadableStream;
    stderr: ReadableStream | NodeJS.ReadableStream;
    wait(): Promise<{
        code: number;
    }>;
}
interface TerminalTester {
    start(): Promise<void>;
    stop(): Promise<void>;
    restart(): Promise<void>;
    isRunning(): boolean;
    sendText(text: string): Promise<void>;
    sendKey(key: string, modifiers?: KeyModifiers): Promise<void>;
    sendKeys(keys: string[]): Promise<void>;
    sendMouse(event: MouseEvent): Promise<void>;
    paste(text: string): Promise<void>;
    typeText(text: string, delayMs?: number): Promise<void>;
    captureScreen(): Promise<ScreenCapture>;
    getScreenText(): Promise<string>;
    getScreenLines(): Promise<string[]>;
    waitForText(text: string, options?: WaitOptions): Promise<void>;
    waitForPattern(pattern: RegExp, options?: WaitOptions): Promise<void>;
    waitForLine(lineNumber: number, text: string, options?: WaitOptions): Promise<void>;
    assertScreen(expected: string[] | string, options?: AssertionOptions): Promise<void>;
    assertScreenContains(text: string, options?: AssertionOptions): Promise<void>;
    assertScreenMatches(pattern: RegExp, options?: AssertionOptions): Promise<void>;
    assertCursorAt(position: Point): Promise<void>;
    takeSnapshot(name?: string): Promise<Snapshot>;
    compareSnapshot(snapshot: Snapshot | string): Promise<boolean>;
    saveSnapshot(snapshot: Snapshot, path?: string): Promise<void>;
    loadSnapshot(path: string): Promise<Snapshot>;
    resize(size: TerminalSize): Promise<void>;
    clear(): Promise<void>;
    reset(): Promise<void>;
    getSize(): TerminalSize;
    startRecording(): void;
    stopRecording(): Recording;
    playRecording(recording: Recording, speed?: number): Promise<void>;
    sleep(ms: number): Promise<void>;
    debug(message: string): void;
}
interface TestScenario {
    name: string;
    setup?: () => Promise<void>;
    teardown?: () => Promise<void>;
    steps: TestStep[];
}
interface TestStep {
    name: string;
    action: (tester: TerminalTester) => Promise<void>;
    assertion?: (tester: TerminalTester) => Promise<void>;
    skipOn?: Runtime[];
    timeout?: number;
}
interface TestResult {
    scenario: string;
    passed: boolean;
    duration: number;
    steps: StepResult[];
    error?: Error;
    captures?: ScreenCapture[];
}
interface StepResult {
    name: string;
    passed: boolean;
    duration: number;
    error?: Error;
    capture?: ScreenCapture;
}

export type { AssertionOptions as A, ChildProcess as C, KeyModifiers as K, MouseButton as M, Point as P, Rectangle as R, ScreenCapture as S, TerminalSize as T, WaitOptions as W, MouseEvent as a, KeyEvent as b, Snapshot as c, TesterConfig as d, Recording as e, RecordedEvent as f, Runtime as g, RuntimeAdapter as h, TerminalTester as i, TestScenario as j, TestStep as k, TestResult as l, StepResult as m };
