package com.fastbee.iot.strategy.factory;

import com.fastbee.iot.strategy.DeviceRealTimeDataGetStrategy;
import com.fastbee.iot.strategy.impl.RenKeDeviceRealTimeGetStrategy;
import com.fastbee.iot.strategy.impl.ZhanLianDeviceRealTimeDataGetStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class DeviceRealTimeDataGetFactory {
    @Autowired
    private ZhanLianDeviceRealTimeDataGetStrategy zhanLianDeviceRealTimeDataGetStrategy;

    @Autowired
    private RenKeDeviceRealTimeGetStrategy renKeDeviceRealTimeGetStrategy;

    /**
     * 根据设备品牌获取设备实时数据策略
     * @param deviceBrand 设备品牌
     * @return 设备实时数据策略
     */

    public DeviceRealTimeDataGetStrategy getDeviceRealTimeDataGetStrategy(String deviceBrand){
        if(deviceBrand.equals("展连IOT")){
            return zhanLianDeviceRealTimeDataGetStrategy;
        }else if(deviceBrand.equals("仁科")){
            return renKeDeviceRealTimeGetStrategy;
        }else {
            throw new RuntimeException("暂不支持该设备品牌");
        }

    }
}
