// SPDX-FileCopyrightText: 2023 CELESTIFYX Team
// SPDX-License-Identifier: GPL-3.0-or-later

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TokenType {
    Char,
    Space,
    Color,
    Newline
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Token {
    pub token_type: TokenType,
    pub value: Option<String>
}

impl Token {
    pub fn new(token_type: TokenType, value: Option<String>) -> Self {
        Self {
            token_type,
            value
        }
    }

    pub fn is_solid(&self) -> bool {
        self.token_type == TokenType::Char
    }

    pub fn is_space(&self) -> bool {
        self.token_type == TokenType::Space
    }

    pub fn has_zero_width(&self) -> bool {
        self.token_type == TokenType::Color
    }
}
