"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.appClientManager = void 0;
const enum_1 = require("@/@types/enum");
/**
 * 管理不同调试器的 AppClient 通道
 */
class AppClientManager {
    constructor() {
        this.androidAppClientOptionList = [];
        this.iOSAppClientOptionList = [];
    }
    /**
     * 添加安卓 AppClient 构造器 option
     */
    addAndroidAppClientOption(appClientOption) {
        this.androidAppClientOptionList.push(appClientOption);
    }
    /**
     * 根据平台查询 AppClient 构造器 options
     */
    getAppClientOptions(platform) {
        if (platform === enum_1.DevicePlatform.Android)
            return this.androidAppClientOptionList;
        if (platform === enum_1.DevicePlatform.IOS)
            return this.iOSAppClientOptionList;
    }
    /**
     * 添加 iOS AppClient 构造器 option
     */
    addIOSAppClientOption(appClientOption) {
        this.iOSAppClientOptionList.push(appClientOption);
    }
    /**
     * 清空 AppClient 构造器 options
     */
    clear() {
        this.androidAppClientOptionList = [];
        this.iOSAppClientOptionList = [];
    }
    /**
     * 根据平台查询是否 AppClientType 可用
     */
    shouldUseAppClientType(platform, type) {
        const options = this.getAppClientOptions(platform);
        return Boolean(options.find((item) => item.Ctor.name === type));
    }
}
exports.appClientManager = new AppClientManager();
