// src/state/pages/canvas_state.rs

use common::proto::komp_ac::search::search_response::Hit;

pub trait CanvasState {
    // --- Existing methods (unchanged) ---
    fn current_field(&self) -> usize;
    fn current_cursor_pos(&self) -> usize;
    fn has_unsaved_changes(&self) -> bool;
    fn inputs(&self) -> Vec<&String>;
    fn get_current_input(&self) -> &str;
    fn get_current_input_mut(&mut self) -> &mut String;
    fn fields(&self) -> Vec<&str>;
    fn set_current_field(&mut self, index: usize);
    fn set_current_cursor_pos(&mut self, pos: usize);
    fn set_has_unsaved_changes(&mut self, changed: bool);
    fn get_suggestions(&self) -> Option<&[String]>;
    fn get_selected_suggestion_index(&self) -> Option<usize>;
    fn get_rich_suggestions(&self) -> Option<&[Hit]> {
        None
    }

    fn get_display_value_for_field(&self, index: usize) -> &str {
        self.inputs()
            .get(index)
            .map(|s| s.as_str())
            .unwrap_or("")
    }
    fn has_display_override(&self, _index: usize) -> bool {
        false
    }
}
