package com.zanxiang.game.platform.serve.enums;

import com.zanxiang.game.platform.serve.service.platform.PlatformBaseService;
import com.zanxiang.game.platform.serve.service.platform.PlatformDeYangService;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author : lingfeng
 * @time : 2023-05-24
 * @description : 游戏平台枚举
 */
@Getter
@AllArgsConstructor
public enum GamePlatformEnum {

    /**
     * 德扬游戏
     */
    DE_YANG("DE_YANG", "德扬游戏", PlatformDeYangService.class);

    /**
     * 平台key
     */
    private final String platformKey;

    /**
     * 平台名称
     */
    private final String platformName;

    /**
     * 实现类
     */
    private final Class<? extends PlatformBaseService> clazz;

    /**
     * 根据游戏平台key获取枚举
     *
     * @param key : 游戏平台key
     * @return : 游戏平台枚举
     */
    public static GamePlatformEnum getByKey(String key) {
        for (GamePlatformEnum gamePlatformEnum : GamePlatformEnum.values()) {
            if (gamePlatformEnum.getPlatformKey().equals(key)) {
                return gamePlatformEnum;
            }
        }
        return null;
    }
}
