use crate::board::SfenError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum RecordError {
#[error("initial position SFEN cannot be empty")]
EmptyInitPosition,
#[error("invalid initial position SFEN: {0}")]
InvalidInitialPosition(#[from] SfenError),
#[error("invalid record node id {0}")]
InvalidNodeId(usize),
#[error("record node {0} has been removed")]
RemovedNode(usize),
#[error("cannot append a child under terminal node {0}")]
TerminalNode(usize),
#[error("node {child} is not a child of parent {parent}")]
NotChild { parent: usize, child: usize },
#[error("child index {index} is out of range for parent {parent}")]
InvalidChildIndex { parent: usize, index: usize },
#[error("illegal move at current editor position")]
IllegalMove,
}