use crate::country::Country;

const AFG: &str = "AFG";
const ALA: &str = "ALA";
const ALB: &str = "ALB";
const DZA: &str = "DZA";
const ASM: &str = "ASM";
const AND: &str = "AND";
const AGO: &str = "AGO";
const AIA: &str = "AIA";
const ATA: &str = "ATA";
const ATG: &str = "ATG";
const ARG: &str = "ARG";
const ARM: &str = "ARM";
const ABW: &str = "ABW";
const AUS: &str = "AUS";
const AUT: &str = "AUT";
const AZE: &str = "AZE";
const BHS: &str = "BHS";
const BHR: &str = "BHR";
const BGD: &str = "BGD";
const BRB: &str = "BRB";
const BLR: &str = "BLR";
const BEL: &str = "BEL";
const BLZ: &str = "BLZ";
const BEN: &str = "BEN";
const BMU: &str = "BMU";
const BTN: &str = "BTN";
const BOL: &str = "BOL";
const BES: &str = "BES";
const BIH: &str = "BIH";
const BWA: &str = "BWA";
const BVT: &str = "BVT";
const BRA: &str = "BRA";
const IOT: &str = "IOT";
const VGB: &str = "VGB";
const BRN: &str = "BRN";
const BGR: &str = "BGR";
const BFA: &str = "BFA";
const BDI: &str = "BDI";
const CPV: &str = "CPV";
const KHM: &str = "KHM";
const CMR: &str = "CMR";
const CAN: &str = "CAN";
const CYM: &str = "CYM";
const CAF: &str = "CAF";
const TCD: &str = "TCD";
const CHL: &str = "CHL";
const CHN: &str = "CHN";
const HKG: &str = "HKG";
const MAC: &str = "MAC";
const CXR: &str = "CXR";
const CCK: &str = "CCK";
const COL: &str = "COL";
const COM: &str = "COM";
const COG: &str = "COG";
const COK: &str = "COK";
const CRI: &str = "CRI";
const HRV: &str = "HRV";
const CUB: &str = "CUB";
const CUW: &str = "CUW";
const CYP: &str = "CYP";
const CZE: &str = "CZE";
const PRK: &str = "PRK";
const COD: &str = "COD";
const DNK: &str = "DNK";
const DJI: &str = "DJI";
const DMA: &str = "DMA";
const DOM: &str = "DOM";
const ECU: &str = "ECU";
const EGY: &str = "EGY";
const SLV: &str = "SLV";
const GNQ: &str = "GNQ";
const ERI: &str = "ERI";
const EST: &str = "EST";
const SWZ: &str = "SWZ";
const ETH: &str = "ETH";
const FLK: &str = "FLK";
const FRO: &str = "FRO";
const FJI: &str = "FJI";
const FIN: &str = "FIN";
const FRA: &str = "FRA";
const GUF: &str = "GUF";
const PYF: &str = "PYF";
const ATF: &str = "ATF";
const GAB: &str = "GAB";
const GMB: &str = "GMB";
const GEO: &str = "GEO";
const DEU: &str = "DEU";
const GHA: &str = "GHA";
const GIB: &str = "GIB";
const GRC: &str = "GRC";
const GRL: &str = "GRL";
const GRD: &str = "GRD";
const GLP: &str = "GLP";
const GUM: &str = "GUM";
const GTM: &str = "GTM";
const GGY: &str = "GGY";
const GIN: &str = "GIN";
const GNB: &str = "GNB";
const GUY: &str = "GUY";
const HTI: &str = "HTI";
const HMD: &str = "HMD";
const VAT: &str = "VAT";
const HND: &str = "HND";
const HUN: &str = "HUN";
const ISL: &str = "ISL";
const IND: &str = "IND";
const IDN: &str = "IDN";
const IRN: &str = "IRN";
const IRQ: &str = "IRQ";
const IRL: &str = "IRL";
const IMN: &str = "IMN";
const ISR: &str = "ISR";
const ITA: &str = "ITA";
const CIV: &str = "CIV";
const JAM: &str = "JAM";
const JPN: &str = "JPN";
const JEY: &str = "JEY";
const JOR: &str = "JOR";
const KAZ: &str = "KAZ";
const KEN: &str = "KEN";
const KIR: &str = "KIR";
const KWT: &str = "KWT";
const KGZ: &str = "KGZ";
const LAO: &str = "LAO";
const LVA: &str = "LVA";
const LBN: &str = "LBN";
const LSO: &str = "LSO";
const LBR: &str = "LBR";
const LBY: &str = "LBY";
const LIE: &str = "LIE";
const LTU: &str = "LTU";
const LUX: &str = "LUX";
const MDG: &str = "MDG";
const MWI: &str = "MWI";
const MYS: &str = "MYS";
const MDV: &str = "MDV";
const MLI: &str = "MLI";
const MLT: &str = "MLT";
const MHL: &str = "MHL";
const MTQ: &str = "MTQ";
const MRT: &str = "MRT";
const MUS: &str = "MUS";
const MYT: &str = "MYT";
const MEX: &str = "MEX";
const FSM: &str = "FSM";
const MCO: &str = "MCO";
const MNG: &str = "MNG";
const MNE: &str = "MNE";
const MSR: &str = "MSR";
const MAR: &str = "MAR";
const MOZ: &str = "MOZ";
const MMR: &str = "MMR";
const NAM: &str = "NAM";
const NRU: &str = "NRU";
const NPL: &str = "NPL";
const NLD: &str = "NLD";
const NCL: &str = "NCL";
const NZL: &str = "NZL";
const NIC: &str = "NIC";
const NER: &str = "NER";
const NGA: &str = "NGA";
const NIU: &str = "NIU";
const NFK: &str = "NFK";
const MNP: &str = "MNP";
const MKD: &str = "MKD";
const NOR: &str = "NOR";
const OMN: &str = "OMN";
const PAK: &str = "PAK";
const PLW: &str = "PLW";
const PAN: &str = "PAN";
const PNG: &str = "PNG";
const PRY: &str = "PRY";
const PER: &str = "PER";
const PHL: &str = "PHL";
const PCN: &str = "PCN";
const POL: &str = "POL";
const PRT: &str = "PRT";
const PRI: &str = "PRI";
const QAT: &str = "QAT";
const KOR: &str = "KOR";
const MDA: &str = "MDA";
const REU: &str = "REU";
const ROU: &str = "ROU";
const RUS: &str = "RUS";
const RWA: &str = "RWA";
const BLM: &str = "BLM";
const SHN: &str = "SHN";
const KNA: &str = "KNA";
const LCA: &str = "LCA";
const MAF: &str = "MAF";
const SPM: &str = "SPM";
const VCT: &str = "VCT";
const WSM: &str = "WSM";
const SMR: &str = "SMR";
const STP: &str = "STP";
const SAU: &str = "SAU";
const SEN: &str = "SEN";
const SRB: &str = "SRB";
const SYC: &str = "SYC";
const SLE: &str = "SLE";
const SGP: &str = "SGP";
const SXM: &str = "SXM";
const SVK: &str = "SVK";
const SVN: &str = "SVN";
const SLB: &str = "SLB";
const SOM: &str = "SOM";
const ZAF: &str = "ZAF";
const SGS: &str = "SGS";
const SSD: &str = "SSD";
const ESP: &str = "ESP";
const LKA: &str = "LKA";
const PSE: &str = "PSE";
const SDN: &str = "SDN";
const SUR: &str = "SUR";
const SJM: &str = "SJM";
const SWE: &str = "SWE";
const CHE: &str = "CHE";
const SYR: &str = "SYR";
const TWN: &str = "TWN";
const TJK: &str = "TJK";
const THA: &str = "THA";
const TLS: &str = "TLS";
const TGO: &str = "TGO";
const TKL: &str = "TKL";
const TON: &str = "TON";
const TTO: &str = "TTO";
const TUN: &str = "TUN";
const TUR: &str = "TUR";
const TKM: &str = "TKM";
const TCA: &str = "TCA";
const TUV: &str = "TUV";
const UGA: &str = "UGA";
const UKR: &str = "UKR";
const ARE: &str = "ARE";
const GBR: &str = "GBR";
const TZA: &str = "TZA";
const UMI: &str = "UMI";
const USA: &str = "USA";
const VIR: &str = "VIR";
const URY: &str = "URY";
const UZB: &str = "UZB";
const VUT: &str = "VUT";
const VEN: &str = "VEN";
const VNM: &str = "VNM";
const WLF: &str = "WLF";
const ESH: &str = "ESH";
const YEM: &str = "YEM";
const ZMB: &str = "ZMB";
const ZWE: &str = "ZWE";

// Kosovo
const XKX: &str = "XKX";

// Not a Code
pub const NAC: &str = "NAC";

pub fn code_to_country(code: &str) -> Option<Country> {
    let country = match code {
        AFG => Country::AFG,
        ALA => Country::ALA,
        ALB => Country::ALB,
        DZA => Country::DZA,
        ASM => Country::ASM,
        AND => Country::AND,
        AGO => Country::AGO,
        AIA => Country::AIA,
        ATA => Country::ATA,
        ATG => Country::ATG,
        ARG => Country::ARG,
        ARM => Country::ARM,
        ABW => Country::ABW,
        AUS => Country::AUS,
        AUT => Country::AUT,
        AZE => Country::AZE,
        BHS => Country::BHS,
        BHR => Country::BHR,
        BGD => Country::BGD,
        BRB => Country::BRB,
        BLR => Country::BLR,
        BEL => Country::BEL,
        BLZ => Country::BLZ,
        BEN => Country::BEN,
        BMU => Country::BMU,
        BTN => Country::BTN,
        BOL => Country::BOL,
        BES => Country::BES,
        BIH => Country::BIH,
        BWA => Country::BWA,
        BVT => Country::BVT,
        BRA => Country::BRA,
        IOT => Country::IOT,
        VGB => Country::VGB,
        BRN => Country::BRN,
        BGR => Country::BGR,
        BFA => Country::BFA,
        BDI => Country::BDI,
        CPV => Country::CPV,
        KHM => Country::KHM,
        CMR => Country::CMR,
        CAN => Country::CAN,
        CYM => Country::CYM,
        CAF => Country::CAF,
        TCD => Country::TCD,
        CHL => Country::CHL,
        CHN => Country::CHN,
        HKG => Country::HKG,
        MAC => Country::MAC,
        CXR => Country::CXR,
        CCK => Country::CCK,
        COL => Country::COL,
        COM => Country::COM,
        COG => Country::COG,
        COK => Country::COK,
        CRI => Country::CRI,
        HRV => Country::HRV,
        CUB => Country::CUB,
        CUW => Country::CUW,
        CYP => Country::CYP,
        CZE => Country::CZE,
        PRK => Country::PRK,
        COD => Country::COD,
        DNK => Country::DNK,
        DJI => Country::DJI,
        DMA => Country::DMA,
        DOM => Country::DOM,
        ECU => Country::ECU,
        EGY => Country::EGY,
        SLV => Country::SLV,
        GNQ => Country::GNQ,
        ERI => Country::ERI,
        EST => Country::EST,
        SWZ => Country::SWZ,
        ETH => Country::ETH,
        FLK => Country::FLK,
        FRO => Country::FRO,
        FJI => Country::FJI,
        FIN => Country::FIN,
        FRA => Country::FRA,
        GUF => Country::GUF,
        PYF => Country::PYF,
        ATF => Country::ATF,
        GAB => Country::GAB,
        GMB => Country::GMB,
        GEO => Country::GEO,
        DEU => Country::DEU,
        GHA => Country::GHA,
        GIB => Country::GIB,
        GRC => Country::GRC,
        GRL => Country::GRL,
        GRD => Country::GRD,
        GLP => Country::GLP,
        GUM => Country::GUM,
        GTM => Country::GTM,
        GGY => Country::GGY,
        GIN => Country::GIN,
        GNB => Country::GNB,
        GUY => Country::GUY,
        HTI => Country::HTI,
        HMD => Country::HMD,
        VAT => Country::VAT,
        HND => Country::HND,
        HUN => Country::HUN,
        ISL => Country::ISL,
        IND => Country::IND,
        IDN => Country::IDN,
        IRN => Country::IRN,
        IRQ => Country::IRQ,
        IRL => Country::IRL,
        IMN => Country::IMN,
        ISR => Country::ISR,
        ITA => Country::ITA,
        CIV => Country::CIV,
        JAM => Country::JAM,
        JPN => Country::JPN,
        JEY => Country::JEY,
        JOR => Country::JOR,
        KAZ => Country::KAZ,
        KEN => Country::KEN,
        KIR => Country::KIR,
        KWT => Country::KWT,
        KGZ => Country::KGZ,
        LAO => Country::LAO,
        LVA => Country::LVA,
        LBN => Country::LBN,
        LSO => Country::LSO,
        LBR => Country::LBR,
        LBY => Country::LBY,
        LIE => Country::LIE,
        LTU => Country::LTU,
        LUX => Country::LUX,
        MDG => Country::MDG,
        MWI => Country::MWI,
        MYS => Country::MYS,
        MDV => Country::MDV,
        MLI => Country::MLI,
        MLT => Country::MLT,
        MHL => Country::MHL,
        MTQ => Country::MTQ,
        MRT => Country::MRT,
        MUS => Country::MUS,
        MYT => Country::MYT,
        MEX => Country::MEX,
        FSM => Country::FSM,
        MCO => Country::MCO,
        MNG => Country::MNG,
        MNE => Country::MNE,
        MSR => Country::MSR,
        MAR => Country::MAR,
        MOZ => Country::MOZ,
        MMR => Country::MMR,
        NAM => Country::NAM,
        NRU => Country::NRU,
        NPL => Country::NPL,
        NLD => Country::NLD,
        NCL => Country::NCL,
        NZL => Country::NZL,
        NIC => Country::NIC,
        NER => Country::NER,
        NGA => Country::NGA,
        NIU => Country::NIU,
        NFK => Country::NFK,
        MNP => Country::MNP,
        MKD => Country::MKD,
        NOR => Country::NOR,
        OMN => Country::OMN,
        PAK => Country::PAK,
        PLW => Country::PLW,
        PAN => Country::PAN,
        PNG => Country::PNG,
        PRY => Country::PRY,
        PER => Country::PER,
        PHL => Country::PHL,
        PCN => Country::PCN,
        POL => Country::POL,
        PRT => Country::PRT,
        PRI => Country::PRI,
        QAT => Country::QAT,
        KOR => Country::KOR,
        MDA => Country::MDA,
        REU => Country::REU,
        ROU => Country::ROU,
        RUS => Country::RUS,
        RWA => Country::RWA,
        BLM => Country::BLM,
        SHN => Country::SHN,
        KNA => Country::KNA,
        LCA => Country::LCA,
        MAF => Country::MAF,
        SPM => Country::SPM,
        VCT => Country::VCT,
        WSM => Country::WSM,
        SMR => Country::SMR,
        STP => Country::STP,
        SAU => Country::SAU,
        SEN => Country::SEN,
        SRB => Country::SRB,
        SYC => Country::SYC,
        SLE => Country::SLE,
        SGP => Country::SGP,
        SXM => Country::SXM,
        SVK => Country::SVK,
        SVN => Country::SVN,
        SLB => Country::SLB,
        SOM => Country::SOM,
        ZAF => Country::ZAF,
        SGS => Country::SGS,
        SSD => Country::SSD,
        ESP => Country::ESP,
        LKA => Country::LKA,
        PSE => Country::PSE,
        SDN => Country::SDN,
        SUR => Country::SUR,
        SJM => Country::SJM,
        SWE => Country::SWE,
        CHE => Country::CHE,
        SYR => Country::SYR,
        TWN => Country::TWN,
        TJK => Country::TJK,
        THA => Country::THA,
        TLS => Country::TLS,
        TGO => Country::TGO,
        TKL => Country::TKL,
        TON => Country::TON,
        TTO => Country::TTO,
        TUN => Country::TUN,
        TUR => Country::TUR,
        TKM => Country::TKM,
        TCA => Country::TCA,
        TUV => Country::TUV,
        UGA => Country::UGA,
        UKR => Country::UKR,
        ARE => Country::ARE,
        GBR => Country::GBR,
        TZA => Country::TZA,
        UMI => Country::UMI,
        USA => Country::USA,
        VIR => Country::VIR,
        URY => Country::URY,
        UZB => Country::UZB,
        VUT => Country::VUT,
        VEN => Country::VEN,
        VNM => Country::VNM,
        WLF => Country::WLF,
        ESH => Country::ESH,
        YEM => Country::YEM,
        ZMB => Country::ZMB,
        ZWE => Country::ZWE,
        XKX => Country::XKX,
        NAC => Country::NAC,
        _ => return None,
    };
    Some(country)
}

pub const fn country_to_code(country: Country) -> Option<&'static str> {
    let alpha3 = match country {
        Country::AFG => AFG,
        Country::ALA => ALA,
        Country::ALB => ALB,
        Country::DZA => DZA,
        Country::ASM => ASM,
        Country::AND => AND,
        Country::AGO => AGO,
        Country::AIA => AIA,
        Country::ATA => ATA,
        Country::ATG => ATG,
        Country::ARG => ARG,
        Country::ARM => ARM,
        Country::ABW => ABW,
        Country::AUS => AUS,
        Country::AUT => AUT,
        Country::AZE => AZE,
        Country::BHS => BHS,
        Country::BHR => BHR,
        Country::BGD => BGD,
        Country::BRB => BRB,
        Country::BLR => BLR,
        Country::BEL => BEL,
        Country::BLZ => BLZ,
        Country::BEN => BEN,
        Country::BMU => BMU,
        Country::BTN => BTN,
        Country::BOL => BOL,
        Country::BES => BES,
        Country::BIH => BIH,
        Country::BWA => BWA,
        Country::BVT => BVT,
        Country::BRA => BRA,
        Country::IOT => IOT,
        Country::VGB => VGB,
        Country::BRN => BRN,
        Country::BGR => BGR,
        Country::BFA => BFA,
        Country::BDI => BDI,
        Country::CPV => CPV,
        Country::KHM => KHM,
        Country::CMR => CMR,
        Country::CAN => CAN,
        Country::CYM => CYM,
        Country::CAF => CAF,
        Country::TCD => TCD,
        Country::CHL => CHL,
        Country::CHN => CHN,
        Country::HKG => HKG,
        Country::MAC => MAC,
        Country::CXR => CXR,
        Country::CCK => CCK,
        Country::COL => COL,
        Country::COM => COM,
        Country::COG => COG,
        Country::COK => COK,
        Country::CRI => CRI,
        Country::HRV => HRV,
        Country::CUB => CUB,
        Country::CUW => CUW,
        Country::CYP => CYP,
        Country::CZE => CZE,
        Country::PRK => PRK,
        Country::COD => COD,
        Country::DNK => DNK,
        Country::DJI => DJI,
        Country::DMA => DMA,
        Country::DOM => DOM,
        Country::ECU => ECU,
        Country::EGY => EGY,
        Country::SLV => SLV,
        Country::GNQ => GNQ,
        Country::ERI => ERI,
        Country::EST => EST,
        Country::SWZ => SWZ,
        Country::ETH => ETH,
        Country::FLK => FLK,
        Country::FRO => FRO,
        Country::FJI => FJI,
        Country::FIN => FIN,
        Country::FRA => FRA,
        Country::GUF => GUF,
        Country::PYF => PYF,
        Country::ATF => ATF,
        Country::GAB => GAB,
        Country::GMB => GMB,
        Country::GEO => GEO,
        Country::DEU => DEU,
        Country::GHA => GHA,
        Country::GIB => GIB,
        Country::GRC => GRC,
        Country::GRL => GRL,
        Country::GRD => GRD,
        Country::GLP => GLP,
        Country::GUM => GUM,
        Country::GTM => GTM,
        Country::GGY => GGY,
        Country::GIN => GIN,
        Country::GNB => GNB,
        Country::GUY => GUY,
        Country::HTI => HTI,
        Country::HMD => HMD,
        Country::VAT => VAT,
        Country::HND => HND,
        Country::HUN => HUN,
        Country::ISL => ISL,
        Country::IND => IND,
        Country::IDN => IDN,
        Country::IRN => IRN,
        Country::IRQ => IRQ,
        Country::IRL => IRL,
        Country::IMN => IMN,
        Country::ISR => ISR,
        Country::ITA => ITA,
        Country::CIV => CIV,
        Country::JAM => JAM,
        Country::JPN => JPN,
        Country::JEY => JEY,
        Country::JOR => JOR,
        Country::KAZ => KAZ,
        Country::KEN => KEN,
        Country::KIR => KIR,
        Country::KWT => KWT,
        Country::KGZ => KGZ,
        Country::LAO => LAO,
        Country::LVA => LVA,
        Country::LBN => LBN,
        Country::LSO => LSO,
        Country::LBR => LBR,
        Country::LBY => LBY,
        Country::LIE => LIE,
        Country::LTU => LTU,
        Country::LUX => LUX,
        Country::MDG => MDG,
        Country::MWI => MWI,
        Country::MYS => MYS,
        Country::MDV => MDV,
        Country::MLI => MLI,
        Country::MLT => MLT,
        Country::MHL => MHL,
        Country::MTQ => MTQ,
        Country::MRT => MRT,
        Country::MUS => MUS,
        Country::MYT => MYT,
        Country::MEX => MEX,
        Country::FSM => FSM,
        Country::MCO => MCO,
        Country::MNG => MNG,
        Country::MNE => MNE,
        Country::MSR => MSR,
        Country::MAR => MAR,
        Country::MOZ => MOZ,
        Country::MMR => MMR,
        Country::NAM => NAM,
        Country::NRU => NRU,
        Country::NPL => NPL,
        Country::NLD => NLD,
        Country::NCL => NCL,
        Country::NZL => NZL,
        Country::NIC => NIC,
        Country::NER => NER,
        Country::NGA => NGA,
        Country::NIU => NIU,
        Country::NFK => NFK,
        Country::MNP => MNP,
        Country::MKD => MKD,
        Country::NOR => NOR,
        Country::OMN => OMN,
        Country::PAK => PAK,
        Country::PLW => PLW,
        Country::PAN => PAN,
        Country::PNG => PNG,
        Country::PRY => PRY,
        Country::PER => PER,
        Country::PHL => PHL,
        Country::PCN => PCN,
        Country::POL => POL,
        Country::PRT => PRT,
        Country::PRI => PRI,
        Country::QAT => QAT,
        Country::KOR => KOR,
        Country::MDA => MDA,
        Country::REU => REU,
        Country::ROU => ROU,
        Country::RUS => RUS,
        Country::RWA => RWA,
        Country::BLM => BLM,
        Country::SHN => SHN,
        Country::KNA => KNA,
        Country::LCA => LCA,
        Country::MAF => MAF,
        Country::SPM => SPM,
        Country::VCT => VCT,
        Country::WSM => WSM,
        Country::SMR => SMR,
        Country::STP => STP,
        Country::SAU => SAU,
        Country::SEN => SEN,
        Country::SRB => SRB,
        Country::SYC => SYC,
        Country::SLE => SLE,
        Country::SGP => SGP,
        Country::SXM => SXM,
        Country::SVK => SVK,
        Country::SVN => SVN,
        Country::SLB => SLB,
        Country::SOM => SOM,
        Country::ZAF => ZAF,
        Country::SGS => SGS,
        Country::SSD => SSD,
        Country::ESP => ESP,
        Country::LKA => LKA,
        Country::PSE => PSE,
        Country::SDN => SDN,
        Country::SUR => SUR,
        Country::SJM => SJM,
        Country::SWE => SWE,
        Country::CHE => CHE,
        Country::SYR => SYR,
        Country::TWN => TWN,
        Country::TJK => TJK,
        Country::THA => THA,
        Country::TLS => TLS,
        Country::TGO => TGO,
        Country::TKL => TKL,
        Country::TON => TON,
        Country::TTO => TTO,
        Country::TUN => TUN,
        Country::TUR => TUR,
        Country::TKM => TKM,
        Country::TCA => TCA,
        Country::TUV => TUV,
        Country::UGA => UGA,
        Country::UKR => UKR,
        Country::ARE => ARE,
        Country::GBR => GBR,
        Country::TZA => TZA,
        Country::UMI => UMI,
        Country::USA => USA,
        Country::VIR => VIR,
        Country::URY => URY,
        Country::UZB => UZB,
        Country::VUT => VUT,
        Country::VEN => VEN,
        Country::VNM => VNM,
        Country::WLF => WLF,
        Country::ESH => ESH,
        Country::YEM => YEM,
        Country::ZMB => ZMB,
        Country::ZWE => ZWE,
        Country::XKX => XKX,
        Country::NAC => NAC,
        _ => return None,
    };
    Some(alpha3)
}
