package com.persagy.adm.server.custom.service.impl.offline_data_download;

import com.persagy.adm.server.custom.common.AdmRequest;
import com.persagy.adm.server.custom.entity.BuildingData;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.List;

@Component
@Slf4j
public class FillBuildingDataChain implements FillData<BuildingData>{
    List<FillData<BuildingData>> fillList;

    @Autowired
    FillProblem fillProblem;
    @Autowired
    FillCad fillCad;

    @PostConstruct
    public void init(){
        fillList = Lists.newArrayList();
        // 问题数据
        fillList.add(fillProblem);
        // CAD图纸
        fillList.add(fillCad);
    }

    @Override
    public void fill(AdmRequest admRequest, BuildingData downLoadData) {
        fillList.forEach(buildingDataFillData -> buildingDataFillData.fill(admRequest,downLoadData));
    }
}
