//! Format-agnostic cursor context types for schema-driven completion.

/// Describes where the cursor is within a structured document.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CursorContext {
    /// Table/section path from root to the cursor's containing table.
    ///
    /// For example, a cursor inside `[package]` yields `["package"]`.
    /// A cursor inside a top-level `[dependencies]` yields `["dependencies"]`.
    /// An empty vec means the cursor is at the root level.
    pub section_path: Vec<String>,

    /// What kind of completion is expected at the cursor.
    pub mode: CompletionMode,
}

/// The type of completion needed at the cursor position.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum CompletionMode {
    /// Completing a **key name** at the current table level.
    ///
    /// Example: cursor is at start of line inside `[package]` → suggest
    /// `name`, `version`, `edition`, etc.
    Key,

    /// Completing the **value** for a known key.
    ///
    /// Example: cursor is after `publish = ` → suggest `true` / `false`.
    Value { key: String },

    /// Completing a **key name inside an inline table** (or flow mapping).
    ///
    /// Example: cursor is inside `serde = { ` → suggest `version`,
    /// `features`, `optional`, etc.
    InlineKey,
}
