/*
 * SPDX-FileCopyrightText: Sebastiano Barezzi
 * SPDX-License-Identifier: Apache-2.0
 */

package com.xyzshell.andinfo.libs.cpu.models

/**
 * `enum cpuinfo_vendor`
 * CPU供应商枚举
 *
 * Vendor of processor core design
 * 处理器核心设计的供应商
 */
enum class Vendor(
    val value: UInt,
) {
    /**
     * Processor vendor is not known to the library, or the library failed
     * to get vendor information from the OS.
     * 处理器供应商未知，或库无法从操作系统获取供应商信息
     */
    UNKNOWN(0U),

    /**
     * Intel Corporation. Vendor of x86, x86-64, IA64, and ARM processor
     * microarchitectures.
     * 英特尔公司。x86、x86-64、IA64和ARM处理器微架构的供应商
     *
     * Sold its ARM design subsidiary in 2006. The last ARM processor design
     * was released in 2004.
     * 2006年出售了其ARM设计子公司。最后一款ARM处理器设计于2004年发布
     */
    INTEL(1U),

    /**
     * Advanced Micro Devices, Inc. Vendor of x86 and x86-64 processor
     * microarchitectures.
     * 超威半导体公司（AMD）。x86和x86-64处理器微架构的供应商
     */
    AMD(2U),

    /**
     * ARM Holdings plc. Vendor of ARM and ARM64 processor
     * microarchitectures.
     * ARM控股有限公司。ARM和ARM64处理器微架构的供应商
     */
    ARM(3U),

    /**
     * Qualcomm Incorporated. Vendor of ARM and ARM64 processor
     * microarchitectures.
     * 高通公司。ARM和ARM64处理器微架构的供应商
     */
    QUALCOMM(4U),

    /**
     * Apple Inc. Vendor of ARM and ARM64 processor microarchitectures.
     * 苹果公司。ARM和ARM64处理器微架构的供应商
     */
    APPLE(5U),

    /**
     * Samsung Electronics Co., Ltd. Vendir if ARM64 processor
     * microarchitectures.
     * 三星电子有限公司。ARM64处理器微架构的供应商
     */
    SAMSUNG(6U),

    /**
     * Nvidia Corporation. Vendor of ARM64-compatible processor
     * microarchitectures.
     * 英伟达公司。ARM64兼容处理器微架构的供应商
     */
    NVIDIA(7U),

    /**
     * MIPS Technologies, Inc. Vendor of MIPS processor microarchitectures.
     * MIPS科技公司。MIPS处理器微架构的供应商
     */
    MIPS(8U),

    /**
     * International Business Machines Corporation. Vendor of PowerPC
     * processor microarchitectures.
     * 国际商业机器公司（IBM）。PowerPC处理器微架构的供应商
     */
    IBM(9U),

    /**
     * Ingenic Semiconductor. Vendor of MIPS processor microarchitectures.
     * 君正半导体。MIPS处理器微架构的供应商
     */
    INGENIC(10U),

    /**
     * VIA Technologies, Inc. Vendor of x86 and x86-64 processor
     * microarchitectures.
     * 威盛科技股份有限公司。x86和x86-64处理器微架构的供应商
     *
     * Processors are designed by Centaur Technology, a subsidiary of VIA
     * Technologies.
     * 处理器由威盛科技的子公司Centaur Technology设计
     */
    VIA(11U),

    /**
     * Cavium, Inc. Vendor of ARM64 processor microarchitectures.
     * Cavium公司。ARM64处理器微架构的供应商
     */
    CAVIUM(12U),

    /**
     * Broadcom, Inc. Vendor of ARM processor microarchitectures.
     * 博通公司。ARM处理器微架构的供应商
     */
    BROADCOM(13U),

    /**
     * Applied Micro Circuits Corporation (APM). Vendor of ARM64 processor
     * microarchitectures.
     * 应用微电路公司（APM）。ARM64处理器微架构的供应商
     */
    APM(14U),

    /**
     * Huawei Technologies Co., Ltd. Vendor of ARM64 processor
     * microarchitectures.
     * 华为技术有限公司。ARM64处理器微架构的供应商
     *
     * Processors are designed by HiSilicon, a subsidiary of Huawei.
     * 处理器由华为的子公司海思半导体设计
     */
    HUAWEI(15U),

    /**
     * Hygon (Chengdu Haiguang Integrated Circuit Design Co., Ltd), Vendor
     * of x86-64 processor microarchitectures.
     * 海光（成都海光集成电路设计有限公司）。x86-64处理器微架构的供应商
     *
     * Processors are variants of AMD cores.
     * 处理器是AMD核心的变体
     */
    HYGON(16U),

    /**
     * SiFive, Inc. Vendor of RISC-V processor microarchitectures.
     * SiFive公司。RISC-V处理器微架构的供应商
     */
    SIFIVE(17U),

    /**
     * Texas Instruments Inc. Vendor of ARM processor microarchitectures.
     * 德州仪器公司。ARM处理器微架构的供应商
     */
    TEXAS_INSTRUMENTS(30U),

    /**
     * Marvell Technology Group Ltd. Vendor of ARM processor
     * microarchitectures.
     * 美满电子科技集团。ARM处理器微架构的供应商
     */
    MARVELL(31U),

    /**
     * RDC Semiconductor Co., Ltd. Vendor of x86 processor
     * microarchitectures.
     * 扬智科技股份有限公司。x86处理器微架构的供应商
     */
    RDC(32U),

    /**
     * DM&P Electronics Inc. Vendor of x86 processor microarchitectures.
     * 帝睿电子公司。x86处理器微架构的供应商
     */
    DMP(33U),

    /**
     * Motorola, Inc. Vendor of PowerPC and ARM processor
     * microarchitectures.
     * 摩托罗拉公司。PowerPC和ARM处理器微架构的供应商
     */
    MOTOROLA(34U),

    /**
     * Transmeta Corporation. Vendor of x86 processor microarchitectures.
     * 全美达公司。x86处理器微架构的供应商
     *
     * Now defunct. The last processor design was released in 2004.
     * Transmeta processors implemented VLIW ISA and used binary translation
     * to execute x86 code.
     * 现已倒闭。最后一款处理器设计于2004年发布。全美达处理器实现了VLIW指令集，
     * 并使用二进制翻译来执行x86代码
     */
    TRANSMETA(50U),

    /**
     * Cyrix Corporation. Vendor of x86 processor microarchitectures.
     * Cyrix公司。x86处理器微架构的供应商
     *
     * Now defunct. The last processor design was released in 1996.
     * 现已倒闭。最后一款处理器设计于1996年发布
     */
    CYRIX(51U),

    /**
     * Rise Technology. Vendor of x86 processor microarchitectures.
     * Rise科技。x86处理器微架构的供应商
     *
     * Now defunct. The last processor design was released in 1999.
     * 现已倒闭。最后一款处理器设计于1999年发布
     */
    RISE(52U),

    /**
     * National Semiconductor. Vendor of x86 processor microarchitectures.
     * 美国国家半导体公司。x86处理器微架构的供应商
     *
     * Sold its x86 design subsidiary in 1999. The last processor design was
     * released in 1998.
     * 1999年出售了其x86设计子公司。最后一款处理器设计于1998年发布
     */
    NSC(53U),

    /**
     * Silicon Integrated Systems. Vendor of x86 processor
     * microarchitectures.
     * 矽统科技。x86处理器微架构的供应商
     *
     * Sold its x86 design subsidiary in 2001. The last processor design was
     * released in 2001.
     * 2001年出售了其x86设计子公司。最后一款处理器设计于2001年发布
     */
    SIS(54U),

    /**
     * NexGen. Vendor of x86 processor microarchitectures.
     * NexGen公司。x86处理器微架构的供应商
     *
     * Now defunct. The last processor design was released in 1994.
     * NexGen designed the first x86 microarchitecture which decomposed x86
     * instructions into simple microoperations.
     * 现已倒闭。最后一款处理器设计于1994年发布。NexGen设计了第一个将x86
     * 指令分解为简单微操作的x86微架构
     */
    NEXGEN(55U),

    /**
     * United Microelectronics Corporation. Vendor of x86 processor
     * microarchitectures.
     * 联华电子公司。x86处理器微架构的供应商
     *
     * Ceased x86 in the early 1990s. The last processor design was released
     * in 1991. Designed U5C and U5D processors. Both are 486 level.
     * 在1990年代初停止x86业务。最后一款处理器设计于1991年发布。设计了U5C
     * 和U5D处理器，均为486级别
     */
    UMC(56U),

    /**
     * Digital Equipment Corporation. Vendor of ARM processor
     * microarchitecture.
     * 迪吉多公司（DEC）。ARM处理器微架构的供应商
     *
     * Sold its ARM designs in 1997. The last processor design was released
     * in 1997.
     * 1997年出售了其ARM设计。最后一款处理器设计于1997年发布
     */
    DEC(57U);

    companion object {
        @JvmStatic
        fun fromCpuInfo(value: Int) = value.toUInt().let {
            entries.firstOrNull { vendor -> vendor.value == it } ?: UNKNOWN
        }
    }
}
