use std::str::FromStr;

use std::fmt::{Debug, Display, Error, Formatter};

pub const USD: Symbol = Symbol::Fiat(Fiat::USD);
pub const BTC: Symbol = Symbol::Crypto(Crypto::BTC);
pub const LINK: Symbol = Symbol::Crypto(Crypto::LINK);
pub const USDT: Symbol = Symbol::Crypto(Crypto::USDT);

#[derive(Clone, Copy, Eq, Hash, PartialEq)]
pub enum Symbol {
    Fiat(Fiat),
    Crypto(Crypto),
}

impl Symbol {
    pub fn symbol(&self) -> String {
        match self {
            Symbol::Fiat(ref symbol) => symbol.symbol(),
            Symbol::Crypto(ref symbol) => symbol.symbol(),
        }
    }
}

impl Display for Symbol {
    fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
        match self {
            Symbol::Fiat(ref symbol) => f.write_fmt(format_args!("{:}", &symbol))?,
            Symbol::Crypto(ref symbol) => f.write_fmt(format_args!("{:}", &symbol))?,
        }
        Ok(())
    }
}

impl Debug for Symbol {
    fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
        match self {
            Symbol::Fiat(ref symbol) => f.write_fmt(format_args!("Fiat({:#})", &symbol))?,
            Symbol::Crypto(ref symbol) => f.write_fmt(format_args!("Crypto({:#})", &symbol))?,
        }
        Ok(())
    }
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ParseSymbolError {}

impl FromStr for Symbol {
    type Err = ParseSymbolError;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s {
            "AED" => Ok(Symbol::Fiat(Fiat::AED)),
            "AFN" => Ok(Symbol::Fiat(Fiat::AFN)),
            "ALL" => Ok(Symbol::Fiat(Fiat::ALL)),
            "AMD" => Ok(Symbol::Fiat(Fiat::AMD)),
            "ANG" => Ok(Symbol::Fiat(Fiat::ANG)),
            "AOA" => Ok(Symbol::Fiat(Fiat::AOA)),
            "ARS" => Ok(Symbol::Fiat(Fiat::ARS)),
            "AUD" => Ok(Symbol::Fiat(Fiat::AUD)),
            "AWG" => Ok(Symbol::Fiat(Fiat::AWG)),
            "AZN" => Ok(Symbol::Fiat(Fiat::AZN)),
            "BBD" => Ok(Symbol::Fiat(Fiat::BBD)),
            "BDT" => Ok(Symbol::Fiat(Fiat::BDT)),
            "BGN" => Ok(Symbol::Fiat(Fiat::BGN)),
            "BHD" => Ok(Symbol::Fiat(Fiat::BHD)),
            "BIF" => Ok(Symbol::Fiat(Fiat::BIF)),
            "BMD" => Ok(Symbol::Fiat(Fiat::BMD)),
            "BND" => Ok(Symbol::Fiat(Fiat::BND)),
            "BOB" => Ok(Symbol::Fiat(Fiat::BOB)),
            "BRL" => Ok(Symbol::Fiat(Fiat::BRL)),
            "BSD" => Ok(Symbol::Fiat(Fiat::BSD)),
            "BTN" => Ok(Symbol::Fiat(Fiat::BTN)),
            "BWP" => Ok(Symbol::Fiat(Fiat::BWP)),
            "BYN" => Ok(Symbol::Fiat(Fiat::BYN)),
            "BZD" => Ok(Symbol::Fiat(Fiat::BZD)),
            "CAD" => Ok(Symbol::Fiat(Fiat::CAD)),
            "CDF" => Ok(Symbol::Fiat(Fiat::CDF)),
            "CHF" => Ok(Symbol::Fiat(Fiat::CHF)),
            "CKD" => Ok(Symbol::Fiat(Fiat::CKD)),
            "CLP" => Ok(Symbol::Fiat(Fiat::CLP)),
            "CNY" => Ok(Symbol::Fiat(Fiat::CNY)),
            "COP" => Ok(Symbol::Fiat(Fiat::COP)),
            "CRC" => Ok(Symbol::Fiat(Fiat::CRC)),
            "CUP" => Ok(Symbol::Fiat(Fiat::CUP)),
            "CVE" => Ok(Symbol::Fiat(Fiat::CVE)),
            "CZK" => Ok(Symbol::Fiat(Fiat::CZK)),
            "DJF" => Ok(Symbol::Fiat(Fiat::DJF)),
            "DKK" => Ok(Symbol::Fiat(Fiat::DKK)),
            "DOP" => Ok(Symbol::Fiat(Fiat::DOP)),
            "DZD" => Ok(Symbol::Fiat(Fiat::DZD)),
            "EGP" => Ok(Symbol::Fiat(Fiat::EGP)),
            "ERN" => Ok(Symbol::Fiat(Fiat::ERN)),
            "ETB" => Ok(Symbol::Fiat(Fiat::ETB)),
            "EUR" => Ok(Symbol::Fiat(Fiat::EUR)),
            "FJD" => Ok(Symbol::Fiat(Fiat::FJD)),
            "FKP" => Ok(Symbol::Fiat(Fiat::FKP)),
            "FOK" => Ok(Symbol::Fiat(Fiat::FOK)),
            "GBP" => Ok(Symbol::Fiat(Fiat::GBP)),
            "GEL" => Ok(Symbol::Fiat(Fiat::GEL)),
            "GGP" => Ok(Symbol::Fiat(Fiat::GGP)),
            "GHS" => Ok(Symbol::Fiat(Fiat::GHS)),
            "GIP" => Ok(Symbol::Fiat(Fiat::GIP)),
            "GMD" => Ok(Symbol::Fiat(Fiat::GMD)),
            "GNF" => Ok(Symbol::Fiat(Fiat::GNF)),
            "GTQ" => Ok(Symbol::Fiat(Fiat::GTQ)),
            "GYD" => Ok(Symbol::Fiat(Fiat::GYD)),
            "HKD" => Ok(Symbol::Fiat(Fiat::HKD)),
            "HNL" => Ok(Symbol::Fiat(Fiat::HNL)),
            "HRK" => Ok(Symbol::Fiat(Fiat::HRK)),
            "HTG" => Ok(Symbol::Fiat(Fiat::HTG)),
            "HUF" => Ok(Symbol::Fiat(Fiat::HUF)),
            "IDR" => Ok(Symbol::Fiat(Fiat::IDR)),
            "ILS" => Ok(Symbol::Fiat(Fiat::ILS)),
            "IMP" => Ok(Symbol::Fiat(Fiat::IMP)),
            "INR" => Ok(Symbol::Fiat(Fiat::INR)),
            "IQD" => Ok(Symbol::Fiat(Fiat::IQD)),
            "IRR" => Ok(Symbol::Fiat(Fiat::IRR)),
            "ISK" => Ok(Symbol::Fiat(Fiat::ISK)),
            "JEP" => Ok(Symbol::Fiat(Fiat::JEP)),
            "JMD" => Ok(Symbol::Fiat(Fiat::JMD)),
            "JOD" => Ok(Symbol::Fiat(Fiat::JOD)),
            "JPY" => Ok(Symbol::Fiat(Fiat::JPY)),
            "KES" => Ok(Symbol::Fiat(Fiat::KES)),
            "KGS" => Ok(Symbol::Fiat(Fiat::KGS)),
            "KHR" => Ok(Symbol::Fiat(Fiat::KHR)),
            "KID" => Ok(Symbol::Fiat(Fiat::KID)),
            "KM" => Ok(Symbol::Fiat(Fiat::KM)),
            "KMF" => Ok(Symbol::Fiat(Fiat::KMF)),
            "KPW" => Ok(Symbol::Fiat(Fiat::KPW)),
            "KRW" => Ok(Symbol::Fiat(Fiat::KRW)),
            "KWD" => Ok(Symbol::Fiat(Fiat::KWD)),
            "KYD" => Ok(Symbol::Fiat(Fiat::KYD)),
            "KZT" => Ok(Symbol::Fiat(Fiat::KZT)),
            "LAK" => Ok(Symbol::Fiat(Fiat::LAK)),
            "LBP" => Ok(Symbol::Fiat(Fiat::LBP)),
            "LKR" => Ok(Symbol::Fiat(Fiat::LKR)),
            "LRD" => Ok(Symbol::Fiat(Fiat::LRD)),
            "LSL" => Ok(Symbol::Fiat(Fiat::LSL)),
            "LYD" => Ok(Symbol::Fiat(Fiat::LYD)),
            "MAD" => Ok(Symbol::Fiat(Fiat::MAD)),
            "MDL" => Ok(Symbol::Fiat(Fiat::MDL)),
            "MGA" => Ok(Symbol::Fiat(Fiat::MGA)),
            "MKD" => Ok(Symbol::Fiat(Fiat::MKD)),
            "MMK" => Ok(Symbol::Fiat(Fiat::MMK)),
            "MNT" => Ok(Symbol::Fiat(Fiat::MNT)),
            "MOP" => Ok(Symbol::Fiat(Fiat::MOP)),
            "MRU" => Ok(Symbol::Fiat(Fiat::MRU)),
            "MUR" => Ok(Symbol::Fiat(Fiat::MUR)),
            "MVR" => Ok(Symbol::Fiat(Fiat::MVR)),
            "MWK" => Ok(Symbol::Fiat(Fiat::MWK)),
            "MXN" => Ok(Symbol::Fiat(Fiat::MXN)),
            "MYR" => Ok(Symbol::Fiat(Fiat::MYR)),
            "MZN" => Ok(Symbol::Fiat(Fiat::MZN)),
            "NAD" => Ok(Symbol::Fiat(Fiat::NAD)),
            "NGN" => Ok(Symbol::Fiat(Fiat::NGN)),
            "NIO" => Ok(Symbol::Fiat(Fiat::NIO)),
            "NOK" => Ok(Symbol::Fiat(Fiat::NOK)),
            "NPR" => Ok(Symbol::Fiat(Fiat::NPR)),
            "NZD" => Ok(Symbol::Fiat(Fiat::NZD)),
            "OMR" => Ok(Symbol::Fiat(Fiat::OMR)),
            "PAB" => Ok(Symbol::Fiat(Fiat::PAB)),
            "PEN" => Ok(Symbol::Fiat(Fiat::PEN)),
            "PGK" => Ok(Symbol::Fiat(Fiat::PGK)),
            "PHP" => Ok(Symbol::Fiat(Fiat::PHP)),
            "PKR" => Ok(Symbol::Fiat(Fiat::PKR)),
            "PLN" => Ok(Symbol::Fiat(Fiat::PLN)),
            "PND" => Ok(Symbol::Fiat(Fiat::PND)),
            "PRB" => Ok(Symbol::Fiat(Fiat::PRB)),
            "PYG" => Ok(Symbol::Fiat(Fiat::PYG)),
            "QAR" => Ok(Symbol::Fiat(Fiat::QAR)),
            "RON" => Ok(Symbol::Fiat(Fiat::RON)),
            "RSD" => Ok(Symbol::Fiat(Fiat::RSD)),
            "RUB" => Ok(Symbol::Fiat(Fiat::RUB)),
            "RWF" => Ok(Symbol::Fiat(Fiat::RWF)),
            "SAR" => Ok(Symbol::Fiat(Fiat::SAR)),
            "SBD" => Ok(Symbol::Fiat(Fiat::SBD)),
            "SCR" => Ok(Symbol::Fiat(Fiat::SCR)),
            "SDG" => Ok(Symbol::Fiat(Fiat::SDG)),
            "SEK" => Ok(Symbol::Fiat(Fiat::SEK)),
            "SGD" => Ok(Symbol::Fiat(Fiat::SGD)),
            "SHP" => Ok(Symbol::Fiat(Fiat::SHP)),
            "SLL" => Ok(Symbol::Fiat(Fiat::SLL)),
            "SLS" => Ok(Symbol::Fiat(Fiat::SLS)),
            "SOS" => Ok(Symbol::Fiat(Fiat::SOS)),
            "SRD" => Ok(Symbol::Fiat(Fiat::SRD)),
            "SSP" => Ok(Symbol::Fiat(Fiat::SSP)),
            "STN" => Ok(Symbol::Fiat(Fiat::STN)),
            "SYP" => Ok(Symbol::Fiat(Fiat::SYP)),
            "SZL" => Ok(Symbol::Fiat(Fiat::SZL)),
            "THB" => Ok(Symbol::Fiat(Fiat::THB)),
            "TJS" => Ok(Symbol::Fiat(Fiat::TJS)),
            "TMT" => Ok(Symbol::Fiat(Fiat::TMT)),
            "TND" => Ok(Symbol::Fiat(Fiat::TND)),
            "TOP" => Ok(Symbol::Fiat(Fiat::TOP)),
            "TRY" => Ok(Symbol::Fiat(Fiat::TRY)),
            "TTD" => Ok(Symbol::Fiat(Fiat::TTD)),
            "TVD" => Ok(Symbol::Fiat(Fiat::TVD)),
            "TWD" => Ok(Symbol::Fiat(Fiat::TWD)),
            "TZS" => Ok(Symbol::Fiat(Fiat::TZS)),
            "UAH" => Ok(Symbol::Fiat(Fiat::UAH)),
            "UGX" => Ok(Symbol::Fiat(Fiat::UGX)),
            "USD" => Ok(Symbol::Fiat(Fiat::USD)),
            "UYU" => Ok(Symbol::Fiat(Fiat::UYU)),
            "UZS" => Ok(Symbol::Fiat(Fiat::UZS)),
            "VES" => Ok(Symbol::Fiat(Fiat::VES)),
            "VND" => Ok(Symbol::Fiat(Fiat::VND)),
            "VUV" => Ok(Symbol::Fiat(Fiat::VUV)),
            "WST" => Ok(Symbol::Fiat(Fiat::WST)),
            "XAF" => Ok(Symbol::Fiat(Fiat::XAF)),
            "XCD" => Ok(Symbol::Fiat(Fiat::XCD)),
            "XOF" => Ok(Symbol::Fiat(Fiat::XOF)),
            "XPF" => Ok(Symbol::Fiat(Fiat::XPF)),
            "YER" => Ok(Symbol::Fiat(Fiat::YER)),
            "ZAR" => Ok(Symbol::Fiat(Fiat::ZAR)),
            "ZMW" => Ok(Symbol::Fiat(Fiat::ZMW)),
            "ZWB" => Ok(Symbol::Fiat(Fiat::ZWB)),

            "ALGO" => Ok(Symbol::Crypto(Crypto::ALGO)),
            "BAND" => Ok(Symbol::Crypto(Crypto::BAND)),
            "BAT" => Ok(Symbol::Crypto(Crypto::BAT)),
            "BCH" => Ok(Symbol::Crypto(Crypto::BCH)),
            "BSV" => Ok(Symbol::Crypto(Crypto::BSV)),
            "BTC" => Ok(Symbol::Crypto(Crypto::BTC)),
            "CGLD" => Ok(Symbol::Crypto(Crypto::CGLD)),
            "COMP" => Ok(Symbol::Crypto(Crypto::COMP)),
            "DAI" => Ok(Symbol::Crypto(Crypto::DAI)),
            "EOS" => Ok(Symbol::Crypto(Crypto::EOS)),
            "ETH" => Ok(Symbol::Crypto(Crypto::ETH)),
            "GRT" => Ok(Symbol::Crypto(Crypto::GRT)),
            "LINK" => Ok(Symbol::Crypto(Crypto::LINK)),
            "LTC" => Ok(Symbol::Crypto(Crypto::LTC)),
            "MKR" => Ok(Symbol::Crypto(Crypto::MKR)),
            "NMR" => Ok(Symbol::Crypto(Crypto::NMR)),
            "NU" => Ok(Symbol::Crypto(Crypto::NU)),
            "OXT" => Ok(Symbol::Crypto(Crypto::OXT)),
            "USDT" => Ok(Symbol::Crypto(Crypto::USDT)),
            "XLM" => Ok(Symbol::Crypto(Crypto::XLM)),

            _ => Err(ParseSymbolError {}),
        }
    }
}

#[allow(dead_code)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum Fiat {
    AED,
    AFN,
    ALL,
    AMD,
    ANG,
    AOA,
    ARS,
    AUD,
    AWG,
    AZN,
    BBD,
    BDT,
    BGN,
    BHD,
    BIF,
    BMD,
    BND,
    BOB,
    BRL,
    BSD,
    BTN,
    BWP,
    BYN,
    BZD,
    CAD,
    CDF,
    CHF,
    CKD,
    CLP,
    CNY,
    COP,
    CRC,
    CUP,
    CVE,
    CZK,
    DJF,
    DKK,
    DOP,
    DZD,
    EGP,
    ERN,
    ETB,
    EUR,
    FJD,
    FKP,
    FOK,
    GBP,
    GEL,
    GGP,
    GHS,
    GIP,
    GMD,
    GNF,
    GTQ,
    GYD,
    HKD,
    HNL,
    HRK,
    HTG,
    HUF,
    IDR,
    ILS,
    IMP,
    INR,
    IQD,
    IRR,
    ISK,
    JEP,
    JMD,
    JOD,
    JPY,
    KES,
    KGS,
    KHR,
    KID,
    KM,
    KMF,
    KPW,
    KRW,
    KWD,
    KYD,
    KZT,
    LAK,
    LBP,
    LKR,
    LRD,
    LSL,
    LYD,
    MAD,
    MDL,
    MGA,
    MKD,
    MMK,
    MNT,
    MOP,
    MRU,
    MUR,
    MVR,
    MWK,
    MXN,
    MYR,
    MZN,
    NAD,
    NGN,
    NIO,
    NOK,
    NPR,
    NZD,
    OMR,
    PAB,
    PEN,
    PGK,
    PHP,
    PKR,
    PLN,
    PND,
    PRB,
    PYG,
    QAR,
    RON,
    RSD,
    RUB,
    RWF,
    SAR,
    SBD,
    SCR,
    SDG,
    SEK,
    SGD,
    SHP,
    SLL,
    SLS,
    SOS,
    SRD,
    SSP,
    STN,
    SYP,
    SZL,
    THB,
    TJS,
    TMT,
    TND,
    TOP,
    TRY,
    TTD,
    TVD,
    TWD,
    TZS,
    UAH,
    UGX,
    USD,
    UYU,
    UZS,
    VES,
    VND,
    VUV,
    WST,
    XAF,
    XCD,
    XOF,
    XPF,
    YER,
    ZAR,
    ZMW,
    ZWB,
    // Other(String),
}

impl Display for Fiat {
    fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
        match self {
            Fiat::AED => f.write_str("AED")?,
            Fiat::AFN => f.write_str("AFN")?,
            Fiat::ALL => f.write_str("ALL")?,
            Fiat::AMD => f.write_str("AMD")?,
            Fiat::ANG => f.write_str("ANG")?,
            Fiat::AOA => f.write_str("AOA")?,
            Fiat::ARS => f.write_str("ARS")?,
            Fiat::AUD => f.write_str("AUD")?,
            Fiat::AWG => f.write_str("AWG")?,
            Fiat::AZN => f.write_str("AZN")?,
            Fiat::BBD => f.write_str("BBD")?,
            Fiat::BDT => f.write_str("BDT")?,
            Fiat::BGN => f.write_str("BGN")?,
            Fiat::BHD => f.write_str("BHD")?,
            Fiat::BIF => f.write_str("BIF")?,
            Fiat::BMD => f.write_str("BMD")?,
            Fiat::BND => f.write_str("BND")?,
            Fiat::BOB => f.write_str("BOB")?,
            Fiat::BRL => f.write_str("BRL")?,
            Fiat::BSD => f.write_str("BSD")?,
            Fiat::BTN => f.write_str("BTN")?,
            Fiat::BWP => f.write_str("BWP")?,
            Fiat::BYN => f.write_str("BYN")?,
            Fiat::BZD => f.write_str("BZD")?,
            Fiat::CAD => f.write_str("CAD")?,
            Fiat::CDF => f.write_str("CDF")?,
            Fiat::CHF => f.write_str("CHF")?,
            Fiat::CKD => f.write_str("CKD")?,
            Fiat::CLP => f.write_str("CLP")?,
            Fiat::CNY => f.write_str("CNY")?,
            Fiat::COP => f.write_str("COP")?,
            Fiat::CRC => f.write_str("CRC")?,
            Fiat::CUP => f.write_str("CUP")?,
            Fiat::CVE => f.write_str("CVE")?,
            Fiat::CZK => f.write_str("CZK")?,
            Fiat::DJF => f.write_str("DJF")?,
            Fiat::DKK => f.write_str("DKK")?,
            Fiat::DOP => f.write_str("DOP")?,
            Fiat::DZD => f.write_str("DZD")?,
            Fiat::EGP => f.write_str("EGP")?,
            Fiat::ERN => f.write_str("ERN")?,
            Fiat::ETB => f.write_str("ETB")?,
            Fiat::EUR => f.write_str("€")?,
            Fiat::FJD => f.write_str("FJD")?,
            Fiat::FKP => f.write_str("FKP")?,
            Fiat::FOK => f.write_str("FOK")?,
            Fiat::GBP => f.write_str("£")?,
            Fiat::GEL => f.write_str("GEL")?,
            Fiat::GGP => f.write_str("GGP")?,
            Fiat::GHS => f.write_str("GHS")?,
            Fiat::GIP => f.write_str("GIP")?,
            Fiat::GMD => f.write_str("GMD")?,
            Fiat::GNF => f.write_str("GNF")?,
            Fiat::GTQ => f.write_str("GTQ")?,
            Fiat::GYD => f.write_str("GYD")?,
            Fiat::HKD => f.write_str("HKD")?,
            Fiat::HNL => f.write_str("HNL")?,
            Fiat::HRK => f.write_str("HRK")?,
            Fiat::HTG => f.write_str("HTG")?,
            Fiat::HUF => f.write_str("HUF")?,
            Fiat::IDR => f.write_str("IDR")?,
            Fiat::ILS => f.write_str("ILS")?,
            Fiat::IMP => f.write_str("IMP")?,
            Fiat::INR => f.write_str("INR")?,
            Fiat::IQD => f.write_str("IQD")?,
            Fiat::IRR => f.write_str("IRR")?,
            Fiat::ISK => f.write_str("ISK")?,
            Fiat::JEP => f.write_str("JEP")?,
            Fiat::JMD => f.write_str("JMD")?,
            Fiat::JOD => f.write_str("JOD")?,
            Fiat::JPY => f.write_str("JPY")?,
            Fiat::KES => f.write_str("KES")?,
            Fiat::KGS => f.write_str("KGS")?,
            Fiat::KHR => f.write_str("KHR")?,
            Fiat::KID => f.write_str("KID")?,
            Fiat::KM => f.write_str("KM")?,
            Fiat::KMF => f.write_str("KMF")?,
            Fiat::KPW => f.write_str("KPW")?,
            Fiat::KRW => f.write_str("KRW")?,
            Fiat::KWD => f.write_str("KWD")?,
            Fiat::KYD => f.write_str("KYD")?,
            Fiat::KZT => f.write_str("KZT")?,
            Fiat::LAK => f.write_str("LAK")?,
            Fiat::LBP => f.write_str("LBP")?,
            Fiat::LKR => f.write_str("LKR")?,
            Fiat::LRD => f.write_str("LRD")?,
            Fiat::LSL => f.write_str("LSL")?,
            Fiat::LYD => f.write_str("LYD")?,
            Fiat::MAD => f.write_str("MAD")?,
            Fiat::MDL => f.write_str("MDL")?,
            Fiat::MGA => f.write_str("MGA")?,
            Fiat::MKD => f.write_str("MKD")?,
            Fiat::MMK => f.write_str("MMK")?,
            Fiat::MNT => f.write_str("MNT")?,
            Fiat::MOP => f.write_str("MOP")?,
            Fiat::MRU => f.write_str("MRU")?,
            Fiat::MUR => f.write_str("MUR")?,
            Fiat::MVR => f.write_str("MVR")?,
            Fiat::MWK => f.write_str("MWK")?,
            Fiat::MXN => f.write_str("MXN")?,
            Fiat::MYR => f.write_str("MYR")?,
            Fiat::MZN => f.write_str("MZN")?,
            Fiat::NAD => f.write_str("NAD")?,
            Fiat::NGN => f.write_str("NGN")?,
            Fiat::NIO => f.write_str("NIO")?,
            Fiat::NOK => f.write_str("NOK")?,
            Fiat::NPR => f.write_str("NPR")?,
            Fiat::NZD => f.write_str("NZD")?,
            Fiat::OMR => f.write_str("OMR")?,
            Fiat::PAB => f.write_str("PAB")?,
            Fiat::PEN => f.write_str("PEN")?,
            Fiat::PGK => f.write_str("PGK")?,
            Fiat::PHP => f.write_str("PHP")?,
            Fiat::PKR => f.write_str("PKR")?,
            Fiat::PLN => f.write_str("PLN")?,
            Fiat::PND => f.write_str("PND")?,
            Fiat::PRB => f.write_str("PRB")?,
            Fiat::PYG => f.write_str("PYG")?,
            Fiat::QAR => f.write_str("QAR")?,
            Fiat::RON => f.write_str("RON")?,
            Fiat::RSD => f.write_str("RSD")?,
            Fiat::RUB => f.write_str("RUB")?,
            Fiat::RWF => f.write_str("RWF")?,
            Fiat::SAR => f.write_str("SAR")?,
            Fiat::SBD => f.write_str("SBD")?,
            Fiat::SCR => f.write_str("SCR")?,
            Fiat::SDG => f.write_str("SDG")?,
            Fiat::SEK => f.write_str("SEK")?,
            Fiat::SGD => f.write_str("SGD")?,
            Fiat::SHP => f.write_str("SHP")?,
            Fiat::SLL => f.write_str("SLL")?,
            Fiat::SLS => f.write_str("SLS")?,
            Fiat::SOS => f.write_str("SOS")?,
            Fiat::SRD => f.write_str("SRD")?,
            Fiat::SSP => f.write_str("SSP")?,
            Fiat::STN => f.write_str("STN")?,
            Fiat::SYP => f.write_str("SYP")?,
            Fiat::SZL => f.write_str("SZL")?,
            Fiat::THB => f.write_str("THB")?,
            Fiat::TJS => f.write_str("TJS")?,
            Fiat::TMT => f.write_str("TMT")?,
            Fiat::TND => f.write_str("TND")?,
            Fiat::TOP => f.write_str("TOP")?,
            Fiat::TRY => f.write_str("TRY")?,
            Fiat::TTD => f.write_str("TTD")?,
            Fiat::TVD => f.write_str("TVD")?,
            Fiat::TWD => f.write_str("TWD")?,
            Fiat::TZS => f.write_str("TZS")?,
            Fiat::UAH => f.write_str("UAH")?,
            Fiat::UGX => f.write_str("UGX")?,
            Fiat::USD => f.write_str("$")?,
            Fiat::UYU => f.write_str("UYU")?,
            Fiat::UZS => f.write_str("UZS")?,
            Fiat::VES => f.write_str("VES")?,
            Fiat::VND => f.write_str("VND")?,
            Fiat::VUV => f.write_str("VUV")?,
            Fiat::WST => f.write_str("WST")?,
            Fiat::XAF => f.write_str("XAF")?,
            Fiat::XCD => f.write_str("XCD")?,
            Fiat::XOF => f.write_str("XOF")?,
            Fiat::XPF => f.write_str("XPF")?,
            Fiat::YER => f.write_str("YER")?,
            Fiat::ZAR => f.write_str("ZAR")?,
            Fiat::ZMW => f.write_str("ZMW")?,
            Fiat::ZWB => f.write_str("ZWB")?,
            // Fiat::Other(ref symbol) => f.write_str(&symbol)?,
        }
        Ok(())
    }
}

impl Fiat {
    pub fn symbol(&self) -> String {
        match self {
            Fiat::AED => "AED".to_string(),
            Fiat::AFN => "AFN".to_string(),
            Fiat::ALL => "ALL".to_string(),
            Fiat::AMD => "AMD".to_string(),
            Fiat::ANG => "ANG".to_string(),
            Fiat::AOA => "AOA".to_string(),
            Fiat::ARS => "ARS".to_string(),
            Fiat::AUD => "AUD".to_string(),
            Fiat::AWG => "AWG".to_string(),
            Fiat::AZN => "AZN".to_string(),
            Fiat::BBD => "BBD".to_string(),
            Fiat::BDT => "BDT".to_string(),
            Fiat::BGN => "BGN".to_string(),
            Fiat::BHD => "BHD".to_string(),
            Fiat::BIF => "BIF".to_string(),
            Fiat::BMD => "BMD".to_string(),
            Fiat::BND => "BND".to_string(),
            Fiat::BOB => "BOB".to_string(),
            Fiat::BRL => "BRL".to_string(),
            Fiat::BSD => "BSD".to_string(),
            Fiat::BTN => "BTN".to_string(),
            Fiat::BWP => "BWP".to_string(),
            Fiat::BYN => "BYN".to_string(),
            Fiat::BZD => "BZD".to_string(),
            Fiat::CAD => "CAD".to_string(),
            Fiat::CDF => "CDF".to_string(),
            Fiat::CHF => "CHF".to_string(),
            Fiat::CKD => "CKD".to_string(),
            Fiat::CLP => "CLP".to_string(),
            Fiat::CNY => "CNY".to_string(),
            Fiat::COP => "COP".to_string(),
            Fiat::CRC => "CRC".to_string(),
            Fiat::CUP => "CUP".to_string(),
            Fiat::CVE => "CVE".to_string(),
            Fiat::CZK => "CZK".to_string(),
            Fiat::DJF => "DJF".to_string(),
            Fiat::DKK => "DKK".to_string(),
            Fiat::DOP => "DOP".to_string(),
            Fiat::DZD => "DZD".to_string(),
            Fiat::EGP => "EGP".to_string(),
            Fiat::ERN => "ERN".to_string(),
            Fiat::ETB => "ETB".to_string(),
            Fiat::EUR => "EUR".to_string(),
            Fiat::FJD => "FJD".to_string(),
            Fiat::FKP => "FKP".to_string(),
            Fiat::FOK => "FOK".to_string(),
            Fiat::GBP => "GBP".to_string(),
            Fiat::GEL => "GEL".to_string(),
            Fiat::GGP => "GGP".to_string(),
            Fiat::GHS => "GHS".to_string(),
            Fiat::GIP => "GIP".to_string(),
            Fiat::GMD => "GMD".to_string(),
            Fiat::GNF => "GNF".to_string(),
            Fiat::GTQ => "GTQ".to_string(),
            Fiat::GYD => "GYD".to_string(),
            Fiat::HKD => "HKD".to_string(),
            Fiat::HNL => "HNL".to_string(),
            Fiat::HRK => "HRK".to_string(),
            Fiat::HTG => "HTG".to_string(),
            Fiat::HUF => "HUF".to_string(),
            Fiat::IDR => "IDR".to_string(),
            Fiat::ILS => "ILS".to_string(),
            Fiat::IMP => "IMP".to_string(),
            Fiat::INR => "INR".to_string(),
            Fiat::IQD => "IQD".to_string(),
            Fiat::IRR => "IRR".to_string(),
            Fiat::ISK => "ISK".to_string(),
            Fiat::JEP => "JEP".to_string(),
            Fiat::JMD => "JMD".to_string(),
            Fiat::JOD => "JOD".to_string(),
            Fiat::JPY => "JPY".to_string(),
            Fiat::KES => "KES".to_string(),
            Fiat::KGS => "KGS".to_string(),
            Fiat::KHR => "KHR".to_string(),
            Fiat::KID => "KID".to_string(),
            Fiat::KM => "KM".to_string(),
            Fiat::KMF => "KMF".to_string(),
            Fiat::KPW => "KPW".to_string(),
            Fiat::KRW => "KRW".to_string(),
            Fiat::KWD => "KWD".to_string(),
            Fiat::KYD => "KYD".to_string(),
            Fiat::KZT => "KZT".to_string(),
            Fiat::LAK => "LAK".to_string(),
            Fiat::LBP => "LBP".to_string(),
            Fiat::LKR => "LKR".to_string(),
            Fiat::LRD => "LRD".to_string(),
            Fiat::LSL => "LSL".to_string(),
            Fiat::LYD => "LYD".to_string(),
            Fiat::MAD => "MAD".to_string(),
            Fiat::MDL => "MDL".to_string(),
            Fiat::MGA => "MGA".to_string(),
            Fiat::MKD => "MKD".to_string(),
            Fiat::MMK => "MMK".to_string(),
            Fiat::MNT => "MNT".to_string(),
            Fiat::MOP => "MOP".to_string(),
            Fiat::MRU => "MRU".to_string(),
            Fiat::MUR => "MUR".to_string(),
            Fiat::MVR => "MVR".to_string(),
            Fiat::MWK => "MWK".to_string(),
            Fiat::MXN => "MXN".to_string(),
            Fiat::MYR => "MYR".to_string(),
            Fiat::MZN => "MZN".to_string(),
            Fiat::NAD => "NAD".to_string(),
            Fiat::NGN => "NGN".to_string(),
            Fiat::NIO => "NIO".to_string(),
            Fiat::NOK => "NOK".to_string(),
            Fiat::NPR => "NPR".to_string(),
            Fiat::NZD => "NZD".to_string(),
            Fiat::OMR => "OMR".to_string(),
            Fiat::PAB => "PAB".to_string(),
            Fiat::PEN => "PEN".to_string(),
            Fiat::PGK => "PGK".to_string(),
            Fiat::PHP => "PHP".to_string(),
            Fiat::PKR => "PKR".to_string(),
            Fiat::PLN => "PLN".to_string(),
            Fiat::PND => "PND".to_string(),
            Fiat::PRB => "PRB".to_string(),
            Fiat::PYG => "PYG".to_string(),
            Fiat::QAR => "QAR".to_string(),
            Fiat::RON => "RON".to_string(),
            Fiat::RSD => "RSD".to_string(),
            Fiat::RUB => "RUB".to_string(),
            Fiat::RWF => "RWF".to_string(),
            Fiat::SAR => "SAR".to_string(),
            Fiat::SBD => "SBD".to_string(),
            Fiat::SCR => "SCR".to_string(),
            Fiat::SDG => "SDG".to_string(),
            Fiat::SEK => "SEK".to_string(),
            Fiat::SGD => "SGD".to_string(),
            Fiat::SHP => "SHP".to_string(),
            Fiat::SLL => "SLL".to_string(),
            Fiat::SLS => "SLS".to_string(),
            Fiat::SOS => "SOS".to_string(),
            Fiat::SRD => "SRD".to_string(),
            Fiat::SSP => "SSP".to_string(),
            Fiat::STN => "STN".to_string(),
            Fiat::SYP => "SYP".to_string(),
            Fiat::SZL => "SZL".to_string(),
            Fiat::THB => "THB".to_string(),
            Fiat::TJS => "TJS".to_string(),
            Fiat::TMT => "TMT".to_string(),
            Fiat::TND => "TND".to_string(),
            Fiat::TOP => "TOP".to_string(),
            Fiat::TRY => "TRY".to_string(),
            Fiat::TTD => "TTD".to_string(),
            Fiat::TVD => "TVD".to_string(),
            Fiat::TWD => "TWD".to_string(),
            Fiat::TZS => "TZS".to_string(),
            Fiat::UAH => "UAH".to_string(),
            Fiat::UGX => "UGX".to_string(),
            Fiat::USD => "USD".to_string(),
            Fiat::UYU => "UYU".to_string(),
            Fiat::UZS => "UZS".to_string(),
            Fiat::VES => "VES".to_string(),
            Fiat::VND => "VND".to_string(),
            Fiat::VUV => "VUV".to_string(),
            Fiat::WST => "WST".to_string(),
            Fiat::XAF => "XAF".to_string(),
            Fiat::XCD => "XCD".to_string(),
            Fiat::XOF => "XOF".to_string(),
            Fiat::XPF => "XPF".to_string(),
            Fiat::YER => "YER".to_string(),
            Fiat::ZAR => "ZAR".to_string(),
            Fiat::ZMW => "ZMW".to_string(),
            Fiat::ZWB => "ZWB".to_string(),
            // Fiat::Other(ref symbol) => f.write_str(&symbol)?,
        }
    }
}

#[allow(dead_code)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum Crypto {
    ALGO,
    BAND,
    BAT,
    BCH,
    BSV,
    BTC,
    CGLD,
    COMP,
    DAI,
    EOS,
    ETH,
    GRT,
    LINK,
    LTC,
    MKR,
    NMR,
    NU,
    OXT,
    USDT,
    XLM,
    // Other(String),
}

impl Display for Crypto {
    fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
        match self {
            Crypto::ALGO => f.write_str("ALGO")?,
            Crypto::BAND => f.write_str("BAND")?,
            Crypto::BAT => f.write_str("BAT")?,
            Crypto::BCH => f.write_str("BCH")?,
            Crypto::BSV => f.write_str("BSV")?,
            Crypto::BTC => f.write_str("BTC")?,
            Crypto::CGLD => f.write_str("CGLD")?,
            Crypto::COMP => f.write_str("COMP")?,
            Crypto::DAI => f.write_str("DAI")?,
            Crypto::EOS => f.write_str("EOS")?,
            Crypto::ETH => f.write_str("ETH")?,
            Crypto::GRT => f.write_str("GRT")?,
            Crypto::LINK => f.write_str("LINK")?,
            Crypto::LTC => f.write_str("LTC")?,
            Crypto::MKR => f.write_str("MKR")?,
            Crypto::NMR => f.write_str("NMR")?,
            Crypto::NU => f.write_str("NU")?,
            Crypto::OXT => f.write_str("OXT")?,
            Crypto::USDT => f.write_str("USDT")?,
            Crypto::XLM => f.write_str("XLM")?,
            // Crypto::Other(ref symbol) => f.write_str(&symbol)?,
        }
        Ok(())
    }
}

impl Crypto {
    pub fn symbol(&self) -> String {
        format!("{}", self)
    }
}
