use serde::Serialize;

/// Leaf schema types — no nested `Typ`. `Copy`, const-constructible,
/// shared by `Typ` (compile-time) and `SchemaTyp` (runtime).
#[derive(PartialEq, Eq, Clone, Copy, Hash, Debug, Serialize)]
#[serde(tag = "type", content = "data")]
pub enum ScalarTyp {
    Bool,
    U8,
    U16,
    U32,
    U64,
    I32,
    I64,
    F32,
    F64,
    Str,
    /// i64 unix timestamp milliseconds
    Datetime,
    /// u64 unix timestamp milliseconds
    Timestamp,
    /// rust_decimal - 96 bit repr
    Decimal,
    /// u32 big endian id type
    Id32,
    /// u64 big endian id type
    Id64,
    /// Fuid (8 bytes, repr(transparent) over u64_be)
    Fuid,
    /// LowId
    LowId,
    /// byte array
    Bytes,
    Void,
    /// Rust binary JSON representation
    #[serde(rename = "Json")]
    RustJson,
    /// vector of bytes, representing json string
    JsonBytes,
    /// array bytes with bytes count in scheme
    ArrayBytes(u32),
}
