use std::io;
use thiserror::Error;
pub type Result<T> = std::result::Result<T, HdcError>;
#[derive(Error, Debug)]
pub enum HdcError {
#[error("I/O error: {0}")]
Io(#[from] io::Error),
#[error("Protocol error: {0}")]
Protocol(String),
#[error("Handshake failed: {0}")]
HandshakeFailed(String),
#[error("Not connected to HDC server")]
NotConnected,
#[error("Invalid banner: expected 'OHOS HDC', got {0:?}")]
InvalidBanner(Vec<u8>),
#[error("Buffer error: {0}")]
BufferError(String),
#[error("Command failed: {0}")]
CommandFailed(String),
#[error("Operation timed out")]
Timeout,
#[error("Device not found: {0}")]
DeviceNotFound(String),
#[error("UTF-8 error: {0}")]
Utf8(#[from] std::string::FromUtf8Error),
}