use std::fmt::Display;

use serde::{Deserialize, Serialize};

#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ClassTypeName(pub String);

#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ClassType {
    pub name: ClassTypeName,
}

impl Display for ClassTypeName {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

impl From<ClassType> for ClassTypeName {
    fn from(value: ClassType) -> Self {
        value.name
    }
}

impl From<&str> for ClassTypeName {
    fn from(value: &str) -> Self {
        ClassTypeName(value.to_owned())
    }
}
