use thiserror::Error;
#[derive(Debug, Error, Clone, PartialEq, Eq)]
pub enum Error {
#[error("invalid pubkey")]
InvalidPubkey,
#[error("created_at outside acceptable window")]
StaleTimestamp,
#[error("invalid signature")]
BadSignature,
#[error("not a participant of this room")]
NotAParticipant,
#[error("not your turn")]
NotTurnOwner,
#[error("room not found")]
RoomNotFound,
#[error("room is closed or expired")]
RoomClosed,
#[error("turn_n conflict: expected {expected}, got {got}")]
TurnConflict { expected: i64, got: i64 },
#[error("duplicate signed payload within freshness window")]
ReplayDetected,
#[error("message body too large")]
BodyTooLarge,
#[error("invalid json: {0}")]
InvalidJson(String),
#[error("invalid hex: {0}")]
InvalidHex(String),
}