package com.seeyon.apps.src_ydctdatasync.datamap;


import com.seeyon.apps.src_ydctdatasync.utils.EnumMapUtils;

import java.util.Collections;
import java.util.Map;
import java.util.function.Function;

public class GzfwAssetMode extends AbstractAssetDataMapMode{

    @Override
    public void preProcess(Map<String, Object> map) {
        super.preProcess(map);
        String zcTypeFwValue = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产类型","房屋");
        String zcTypeLevel2 = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产二级类型","住宅");
        String has_lift = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"有无电梯", (String) map.get("has_lift"));
        String house_use = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"用途", (String) map.get("house_use"));
        String house_type = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"房屋类型", (String) map.get("variable_002"));
        map.put("zcTypeFwValue",zcTypeFwValue);
        map.put("zcTypeLevel2",zcTypeLevel2);
        map.put("has_lift",has_lift);
        map.put("house_use",house_use);
        map.put("variable_002",house_type);
    }

    @Override
    public Map<String, Function<Object, Object>> getFieldProcessors() {
        return Collections.emptyMap();
    }

    @Override
    public boolean support() {
        return false;
    }

    @Override
    public void transfer(Object target, Object source) {
        commonAttrTransfer(target,source);
        Map<String, Object> targetMap = (Map<String, Object>) target;
        Map<String, Object> sourceMap = (Map<String, Object>) source;
        targetMap.put("资产类型",sourceMap.get("zcTypeFwValue"));//填充资产类型
        targetMap.put("资产二级类型",sourceMap.get("zcTypeLevel2"));//填充资产二级类型
        targetMap.put("资产种类",sourceMap.get("variable_002"));//填充资产种类
        targetMap.put("楼栋",sourceMap.get("variable_001"));//填充楼栋
        targetMap.put("有无电梯",sourceMap.get("has_lift"));//填充有无电梯
        targetMap.put("用途",sourceMap.get("house_use"));//填充房屋用途

        targetMap.put("房号",sourceMap.get("room_number"));//填充房号
    }
}
