use serde::{Deserialize, Serialize};

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

impl SchemaId {
    pub fn new(value: impl Into<String>) -> Self {
        Self(value.into())
    }
}

#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, Deserialize)]
pub struct SchemaVersion(pub u16);

#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct SchemaDescriptor {
    pub id: SchemaId,
    pub version: SchemaVersion,
    pub name: String,
}

impl SchemaDescriptor {
    pub fn new(id: impl Into<String>, version: u16, name: impl Into<String>) -> Self {
        Self {
            id: SchemaId::new(id),
            version: SchemaVersion(version),
            name: name.into(),
        }
    }
}
