/**
 * @description 业务sdk配置
 * @author       朱琦
 * @date         2022/3/2
 */

// 全部业务配置
let allBusinessSdk = {}

/**
 * 配置业务sdk
 * @param {Array} config 业务sdk配置
 */
const addBusinessSdk = (sdkName, sdkClass) => {
    allBusinessSdk[sdkName] = sdkClass
}

/**
 * 初始化配置业务sdk
 * @param {Array} sdkNameArray 需要配置的sdk
 * @param {Object} mapSdk 地图sdk
 * @returns 
 */
const initBusinessSdk = (sdkNameArray, mapSdk) => {
    let returnObjectArray = {}
    for (let name of sdkNameArray) {
        let skdClass = allBusinessSdk[name];
        let sdkObject = skdClass();
        returnObjectArray[name] = sdkObject.init(mapSdk);
    }
    return returnObjectArray;
}

export { addBusinessSdk, initBusinessSdk }