#![feature(step_trait)]
use candid::{CandidType, Nat, Principal};
use ic_stable_structures::{storable::Bound, Storable};
use number::Ex3Uint;
use principal::{is_canister, is_user_principal};
use serde::{Deserialize, Serialize};
use serde_bytes::ByteBuf;
use std::fmt::{Display, Formatter};

pub use version::Version;

pub mod address_types;
pub mod asset;
pub mod balance_changed;
pub mod block;
pub mod chain;
pub mod market;
pub mod number;
pub mod package;
pub mod principal;
pub mod range;
pub mod secret;
pub mod settings;
pub mod sign_schema;
pub mod transaction;
mod util;
pub mod vault;
mod version;
pub mod wallet_identifier;

pub type PublicKey = ByteBuf;
pub type WalletRegisterId = Ex3Uint;
pub type SpotMarketId = Ex3Uint;
pub type OrderId = Ex3Uint;
pub type AssetId = Ex3Uint;
pub type PackageId = Ex3Uint;
pub type AssetAmount = Ex3Uint;
pub type Nonce = Ex3Uint;
pub type BlockHeight = Ex3Uint;
pub type MerkleRoot = [u8; 32];
pub type MerkleNode = [u8; 32];
pub type BlockHash = [u8; 32];
pub type TransactionHash = [u8; 32];
pub type VaultSeqId = u64;
pub type WalletRegistrySeqId = VaultSeqId;
pub type BalanceVaultSeqId = VaultSeqId;
pub type SecretVaultSeqId = VaultSeqId;
pub type DepositId = Ex3Uint;
pub type CandidWalletRegisterId = Nat;
pub type CandidSpotMarketId = Nat;
pub type CandidOrderId = Nat;
pub type CandidPackageId = Nat;
pub type CandidAssetId = Nat;
pub type CandidAssetAmount = Nat;
pub type CandidNonce = Nat;
pub type CandidBlockHeight = Nat;
pub type CandidDepositId = Nat;
new_type_principal!(NodeProvider, false);
new_type_principal!(CanisterId, true);

#[cfg(test)]
mod tests {
    use candid::Principal;

    #[test]
    fn test_ic_management_id_for_canister_id() {
        let id = Principal::management_canister();

        let _canister_id = super::CanisterId::from(id);
    }
}
