package com.m2pool.lease.constant;

import com.m2pool.lease.netty.message.GpuMessage;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description 币种算法
 * @Date 2025/8/18 16:19
 * @Author yyb
 */
public class GpuBrand {

    private static final String NVIDIA= "NVIDIA";

    private static final String AMD= "ADM";

    private static final String APPLE= "APPLE";

    private static final String INTEL= "INTEL";

    private static final List<String> BRAND_LIST;


    static {
        BRAND_LIST = new ArrayList<>();
        BRAND_LIST.add(NVIDIA);
        BRAND_LIST.add(AMD);
        BRAND_LIST.add(APPLE);
        BRAND_LIST.add(INTEL);
    }

    public static List<String> trimBrand(List<String> targetList) {
        return  targetList.stream()
                .map(model -> {
                    for (String brand : BRAND_LIST) {
                        if (model.contains(brand)) {
                            return model.replace(brand, "").trim();
                        }
                    }
                    return model.trim();
                })
                .collect(Collectors.toList());
    }
}
