use serde_json::{Value, json};
use std::collections::HashMap;
use tracing::{debug, info};
use super::common::get_cursor_type;
use crate::{
DriverCallback, DriverCategory, DriverContext, DriverError, DriverResult,
types::{Driver, DriverParameter},
};
#[derive(Debug)]
pub struct MouseControlGetCursorDriver;
#[async_trait::async_trait]
impl Driver for MouseControlGetCursorDriver {
fn name(&self) -> &str {
return "mouse_control_get_cursor";
}
fn description(&self) -> &str {
return "Get the current cursor type (arrow, hand, wait, etc.)";
}
fn usage_hint(&self) -> &str {
return "Use this skill to determine what kind of cursor is currently displayed, which can indicate UI state.";
}
fn parameters(&self) -> Vec<DriverParameter> {
return vec![];
}
fn example_call(&self) -> DriverResult<Value> {
return Ok(json!({
"action": "mouse_control_get_cursor"
}));
}
fn example_output(&self) -> String {
return "Cursor type: arrow".to_string();
}
fn category(&self) -> DriverCategory {
return DriverCategory::Mouse;
}
async fn execute(
&self,
_parameters: &HashMap<String, Value>,
_callback: Option<&dyn DriverCallback>,
_context: Option<&DriverContext>,
) -> DriverResult<String> {
debug!("Executing mouse_control_get_cursor driver");
let cursor_type = get_cursor_type()?;
let result = format!("Cursor type: {}", cursor_type);
info!("Cursor type retrieved: {}", cursor_type);
return Ok(result);
}
fn validate(&self, _parameters: &HashMap<String, Value>) -> DriverResult<()> {
return Ok(());
}
}