import type { AutocompleteProvider } from "./autocomplete.js";
import type { Component } from "./contracts.js";
/**
 * Read-only capabilities of an editor component.
 * Consumers that only need to observe state should depend on this type.
 */
export interface EditorReadAccess {
    /**
     * Returns the raw text currently held in the editor buffer.
     * Does not include any virtual or expanded markers.
     */
    getText(): string;
    /**
     * Returns the text with any inline markers expanded (e.g., paste-mode
     * sentinels replaced by their visible representation).
     * Falls back to `getText()` when not implemented.
     */
    getExpandedText?(): string;
}
/**
 * Mutation capabilities of an editor component.
 * Consumers that drive the editor (set content, trigger history, etc.)
 * depend on this type.
 */
export interface EditorWriteAccess {
    /**
     * Replaces the entire editor buffer with the given text.
     * The cursor is repositioned to the end of the new content.
     */
    setText(text: string): void;
    /**
     * Inserts the given text at the current cursor position,
     * pushing existing content to the right.
     */
    insertTextAtCursor?(text: string): void;
    /**
     * Pushes the given text string into the editor's history ring
     * so it can be recalled with Up / Down arrow navigation.
     */
    addToHistory?(text: string): void;
}
/**
 * Optional visual and autocomplete configuration for an editor component.
 */
export interface EditorDisplayConfig {
    /**
     * ANSI colour-wrap function applied to the editor's border.
     * Receives the border characters and must return a styled string.
     */
    borderColor?: (str: string) => string;
    /**
     * Sets the number of blank columns added on the left and right
     * of the editor's content area.
     */
    setPaddingX?(padding: number): void;
    /**
     * Attaches an autocomplete provider that supplies completion candidates
     * as the user types.
     */
    setAutocompleteProvider?(provider: AutocompleteProvider): void;
    /**
     * Returns an opaque string identifier for this component's keybinding
     * scope, used to resolve per-component keybinding overrides.
     */
    getKeybindingScopeId?(): string;
}
/**
 * Event callbacks wired into the editor lifecycle.
 */
export interface EditorEventCallbacks {
    /**
     * Fired when the user commits the current input (e.g., presses Enter).
     * Receives the final text value at the moment of submission.
     */
    onSubmit?: (text: string) => void;
    /**
     * Fired on every keystroke or programmatic change to the buffer content.
     * Receives the updated text after the change has been applied.
     */
    onChange?: (text: string) => void;
}
/**
 * Full interface for a pluggable editor component.
 *
 * Compose the read, write, display and callback sub-interfaces so that
 * extensions (vim mode, emacs mode, custom keybindings, etc.) remain
 * compatible with the core application while each concern is independently
 * testable.
 *
 * @example
 * ```ts
 * class VimEditor implements EditorComponent {
 *   getText() { return this.buffer; }
 *   setText(t: string) { this.buffer = t; }
 *   // ... Component lifecycle methods
 * }
 * ```
 */
export interface EditorComponent extends Component, EditorReadAccess, EditorWriteAccess, EditorDisplayConfig, EditorEventCallbacks {
}
