use candid::CandidType;
use serde::{Deserialize, Serialize};

/// Registered coin types for BIP-0044
///   https://github.com/satoshilabs/slips/blob/master/slip-0044.md
#[derive(
    Clone, CandidType, Deserialize, Serialize, Hash, Debug, Ord, PartialOrd, Eq, PartialEq,
)]
pub enum Chain {
    Dfinity,
    BinanceSmartChain,
    Bitcoin,
    Ethereum,
    EX3Layer2,
}

impl Chain {
    pub fn to_chain_id(&self) -> u32 {
        match self {
            Chain::Dfinity => 223,
            Chain::BinanceSmartChain => 714,
            Chain::Bitcoin => 0,
            Chain::Ethereum => 60,
            Chain::EX3Layer2 => 10000,
        }
    }
}
