package com.jiayue.ipfcst.dataexchange.dataprocesser.datapacker.powerofreference.iml;

import com.jiayue.ipfcst.console.service.ElectricFieldService;
import com.jiayue.ipfcst.console.service.InverterInfoService;
import com.jiayue.ipfcst.console.service.SysParameterService;
import com.jiayue.ipfcst.console.service.WindTurbineInfoService;
import com.jiayue.ipfcst.dataexchange.dataprocesser.datapacker.powerofreference.BasePowerOfReferenceCalculator;
import com.jiayue.ipfcst.dataexchange.service.ProtocolGatherDataPointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 注入样板机法的配置类
 *
 * @author: xiuwei
 * @version:
 */
@Configuration
public class BasePowerOfReferenceCalculatorConfig {


  /**
   * 样板机计算方式 标识
   */
  private static final String YBJSF = "ybjsf";

  @Autowired
  SysParameterService sysParameterService;


  @Bean
  public BasePowerOfReferenceCalculator basePowerOfReferenceCalculator(WindTurbineInfoService windTurbineInfoService, InverterInfoService inverterInfoService, ElectricFieldService electricFieldService, ProtocolGatherDataPointService protocolGatherDataPointService) {
    if ("1".equals(sysParameterService.getSysParameter(YBJSF, "1"))) {
      return new PowerOfReferenceCalculator1(windTurbineInfoService, inverterInfoService, electricFieldService, protocolGatherDataPointService).init();
    } else {
      return new PowerOfReferenceCalculator2(windTurbineInfoService, inverterInfoService, electricFieldService, protocolGatherDataPointService).init();
    }

  }


}
