package vip.xiaonuo.coldchain.modular.targetroom.listener;

import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.json.JSONArray;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import vip.xiaonuo.auth.core.pojo.SaBaseLoginUser;
import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
import vip.xiaonuo.coldchain.modular.targetroom.param.TargetRoomAddParam;
import vip.xiaonuo.coldchain.modular.targetroom.service.TargetRoomService;
import vip.xiaonuo.common.listener.CommonDataChangeListener;
import vip.xiaonuo.sys.core.enums.SysDataTypeEnum;
import vip.xiaonuo.sys.modular.org.service.impl.SysOrgServiceImpl;

import java.util.List;

@Component
public class RoomListener implements CommonDataChangeListener {

    @Resource
    private TargetRoomService targetRoomService;

    @Override
    public void doAddWithDataIdList(String dataType, List<String> dataIdList) {
        if(dataType.equals(SysDataTypeEnum.ORG.getValue())) {
            TargetRoomAddParam param = new TargetRoomAddParam();
            param.setName("未分类");
            dataIdList.forEach(orgId -> {
                param.setCreateOrg(orgId);
                targetRoomService.add(param);
            });
        }
    }

    @Override
    public void doAddWithDataList(String dataType, JSONArray jsonArray) {

    }

    @Override
    public void doUpdateWithDataIdList(String dataType, List<String> dataIdList) {

    }

    @Override
    public void doUpdateWithDataList(String dataType, JSONArray jsonArray) {

    }

    @Override
    public void doDeleteWithDataIdList(String dataType, List<String> dataIdList) {

    }
}
