use std::{rc::Rc, sync::LazyLock};

use super::{Environment, Node, NodeEnum, Precedence};

#[derive(Debug, Clone, PartialEq, PartialOrd)]
pub struct Empty;
impl Node for Empty {
    fn evaluate(&self, _: &mut Environment) -> Result<Rc<NodeEnum>, String> {
        Ok(Empty::EMPTY.clone())
    }

    fn as_string(&self, _: Option<&Environment>) -> String {
        String::from("{{#VOID}}")
    }

    fn precedence(&self) -> Precedence {
        Precedence::Empty
    }
}

impl Empty {
    pub const EMPTY: LazyLock<Rc<NodeEnum>> = LazyLock::new(|| Rc::new(Empty{}.into()));
}
