use thiserror::Error;
#[derive(Error, Debug)]
pub enum ClientError {
#[error("Failed to connect to the RAC server: {0}")]
ConnectionError(std::io::Error),
#[error("Failed to write data to the stream: {0}")]
StreamWriteError(std::io::Error),
#[error("Failed to read data from the stream: {0}")]
StreamReadError(std::io::Error),
#[error("Failed to read message via WebSocket: {0}")]
WsReadError(String),
#[error("Failed to send message via WebSocket: {0}")]
WsSendError(String),
#[error("Failed to parse data: {0}")]
ParseError(String),
#[error("Server closed the connection while sending a packet")]
ServerClosedConnection,
#[error("User does not exist on the server")]
UserDoesNotExist,
#[error("Incorrect password")]
IncorrectPassword,
#[error("Unexpected response from the server: {0}")]
UnexpectedResponse(String),
#[error("Username is already taken")]
UsernameAlreadyTaken,
#[error("No password specified.")]
NoPassword,
#[error("Failed to initialize TLS connection: {0}")]
TlsInitializationError(String),
#[error("Not connected to WRAC. Establish connection first.")]
NoConnectionWRAC,
}
#[derive(Debug, Clone, Default)]
pub struct Credentials {
pub username: String,
pub password: Option<String>,
}