use candid::Principal;
use num_bigint::BigUint;
use serde_bytes::ByteBuf;

pub mod asset;
pub mod block;
pub mod package;
pub mod secret;
pub mod transaction;
pub mod vault;
mod version;

pub type PublicKey = ByteBuf;
pub type WalletRegisterId = BigUint;
pub type MarketId = BigUint;
pub type OrderId = BigUint;
pub type AssetId = BigUint;
pub type PackageId = BigUint;
pub type AssetAmount = BigUint;
pub type Nonce = BigUint;
pub type CanisterId = Principal;
pub type NodeProvider = Principal;
pub type BlockHeight = BigUint;
pub type MerkleRoot = [u8; 32];
pub type MerkleNode = [u8; 32];
pub type BlockHash = [u8; 32];
pub type TransactionHash = [u8; 32];
pub type TransactionType = BigUint;
pub type VaultSeqId = u64;
pub use version::Version;

#[macro_export(local_inner_macros)]
macro_rules! impl_from_uint_for_enum {
    ($enum_type:ty, $($t:ty),*) => {
        $(
            impl From<$t> for $enum_type {
                fn from(value: $t) -> Self {
                    <$enum_type>::from(BigUint::from(value))
                }
            }
        )*
    };
}
