/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2026 metamuffin <metamuffin.org>
*/

use std::any::TypeId;

pub mod types {
    use crate::Object;
    use std::any::TypeId;

    pub const OBJECT: TypeId = TypeId::of::<Object>();
    pub const STR: TypeId = TypeId::of::<&str>();
    pub const BINARY: TypeId = TypeId::of::<&[u8]>();
    pub const U32: TypeId = TypeId::of::<u32>();
    pub const U64: TypeId = TypeId::of::<u64>();
    pub const I64: TypeId = TypeId::of::<i64>();
    pub const F64: TypeId = TypeId::of::<f64>();
}

#[derive(Clone)]
pub struct TagInfo {
    pub name: &'static str,
    pub r#type: Option<TypeId>,
}

#[macro_export]
macro_rules! fields {
    ($($id:ident: $type:ty = $tag:literal;)*) => {
        $(pub const $id: $crate::TypedTag<$type> = $crate::TypedTag($crate::Tag::new($tag), std::marker::PhantomData);)*
    };
}
#[macro_export]
macro_rules! enums {
    ($($id:ident = $tag:literal;)*) => {
        $(pub const $id: $crate::Tag = $crate::Tag::new($tag);)*
    };
}
