use crate::action::Action;
use crate::role::Role;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Permission denied: {instructions}")]
PermissionDenied { instructions: String },
#[error("No element matched selector: {selector}")]
SelectorNotMatched { selector: String },
#[error("Element stale: could not relocate element")]
ElementStale { selector: String },
#[error("Action {action} not supported on {role}")]
ActionNotSupported { action: Action, role: Role },
#[error("Text value input not supported for this element")]
TextValueNotSupported,
#[error("Timeout after {elapsed:?}")]
Timeout { elapsed: std::time::Duration },
#[error("Invalid selector '{selector}': {message}")]
InvalidSelector { selector: String, message: String },
#[error("Invalid action data: {message}")]
InvalidActionData { message: String },
#[error("Platform error ({code}): {message}")]
Platform { code: i64, message: String },
}