package com.huatek.busi.service.impl.dataoutput.impls;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.google.common.collect.Lists;
import com.huatek.busi.common.CacMonitorTypeCode;
import com.huatek.busi.common.SiteConstants.ExternalTypeEnum;
import com.huatek.busi.common.SiteConstants.SiteTreeEnum;
import com.huatek.busi.service.impl.dataoutput.helper.OptExecutor;
import com.huatek.busi.vo.dataoutput.OutputEquipmentVo;

/**
 * 容性设备
 * 
 * @author anker_cheng
 * @date 2019/10/16
 */
@Component
@OptExecutor(mainEquipmentType = "111", subEquipmentType = "061")
@OptExecutor(mainEquipmentType = "411", subEquipmentType = "031")
public class CapacitanceEquipmentImExecutor extends AbstractDataOutputExecutor {
    @Override
    protected Map<String, Object> getParams(OutputEquipmentVo vo, LocalDate day) {
        Map<String, Object> params = super.getParams(vo, day);
        params.put("cacMonitorTypeCode", CacMonitorTypeCode.CAPACITIVE_EQUIPMENT_IM.getCode());
        SiteTreeEnum siteTreeEnum = SiteTreeEnum.fromValue(vo.getMainEquipmentType());
        if (SiteTreeEnum.BYQ_EQM == siteTreeEnum) {
            params.put("type", ExternalTypeEnum.BYQ.getValue());
        } else if (SiteTreeEnum.BLQ_HL_EQM == siteTreeEnum) {
            params.put("type", ExternalTypeEnum.BLQ.getValue());
        }
        return params;
    }

    @Override
    protected List<String> getKeys() {
        return Lists.newArrayList("sensorId", "sensorName", "timeStamp", "phase", "capacitance", "lossFactor",
            "unbalanceCurrent", "unbalanceVoltage", "totalCurrent", "systemVoltage");
    }
}
