use thiserror::Error;
use tokio::sync::mpsc::error::SendError;
#[derive(Error, Debug)]
pub enum ConnectError {
#[error("unreachable state {0}")]
UnreachableState(String),
#[error("target state does not exist")]
TargetStateNotExistError,
#[error("channel disconnected while waiting for prompt")]
ChannelDisconnectError,
#[error("connection closed")]
ConnectClosedError,
#[error("{0} no exit command")]
NoExitCommandError(String),
#[error("exec command timeout: {0}")]
ExecTimeout(String),
#[error("connection initialization timeout: {0}")]
InitTimeout(String),
#[error("invalid device handler config: {0}")]
InvalidDeviceHandlerConfig(String),
#[error("invalid command interaction: {0}")]
InvalidCommandInteraction(String),
#[error("invalid command flow template: {0}")]
InvalidCommandFlowTemplate(String),
#[error("async ssh2 error: {0}")]
Ssh2Error(#[from] async_ssh2_tokio::Error),
#[error("russh error: {0}")]
RusshError(#[from] russh::Error),
#[error("Failed to send data: {0}")]
SendDataError(#[from] SendError<String>),
#[error("template not found: {0}")]
TemplateNotFound(String),
#[error("replay mismatch: {0}")]
ReplayMismatchError(String),
#[error("invalid transaction block: {0}")]
InvalidTransaction(String),
#[error("Internal server error: {0}")]
InternalServerError(String),
}