package com.its.pis.process;

import com.its.pis.dao.mapper.batch.PisInfrDao;
import com.its.pis.dao.mapper.batch.PrltCtlrDao;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@RequiredArgsConstructor
@Service
public class MessageDataProcess extends AbstractDbmsJobProcess {

    private final PisInfrDao pisInfrDao;
    private final PrltCtlrDao prltCtlrDao;

//    private final UnitSystMapper unitSystMapper;
//    private final PisInfrMapper pisInfrMapper;
//    private final PrltCtlrMapper prltCtlrMapper;
//    private final VdsStatMapper vdsStatMapper;

    @Override
    protected void postConstruct() {
//        this.unitSystMapper = (UnitSystMapper) AppUtils.getBean(UnitSystMapper.class);
//        this.vdsCtlrMapper = (VdsCtlrMapper) AppUtils.getBean(VdsCtlrMapper.class);
//        this.vdsDtctMapper = (VdsDtctMapper) AppUtils.getBean(VdsDtctMapper.class);
//        this.vdsStatMapper = (VdsStatMapper) AppUtils.getBean(VdsStatMapper.class);
    }

    @Override
    public void process(DbmsJobData data) {
        try {
            int type = data.getType();
//            switch(type) {
//                case DbmsJobType.DATA_TYPE_PIS_STTS:
//                    List<TbPisInfrStts> pisSttsList = (List<TbPisInfrStts>)data.getData();
//                    this.pisInfrDao.updateStts(pisSttsList, data.isHistory());
//                    if (data.isHistory()) {
//                        //this.pisInfrDao.insertStts(pisSttsList);
//                    }
//                    pisSttsList.clear();
//                    break;
//                case DbmsJobType.DATA_TYPE_PRLT_STTS:
//                    List<TbPrltCtlrStts> prltSttsList = (List<TbPrltCtlrStts>)data.getData();
//                    this.prltCtlrDao.updateStts(prltSttsList, data.isHistory());
//                    if (data.isHistory()) {
//                        this.prltCtlrDao.insertStts(prltSttsList);
//                    }
//                    prltSttsList.clear();
//                    break;
//            }
        } catch (Exception e) {
            log.error("DbmsJobProcess.process: Exception: {}", e.toString());
        }
    }

}
