package com.bonus.canteen.core.supply.api;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.supply.mapper.DrpSupplierMapper;
import com.bonus.canteen.core.supply.vo.DrpSupplierVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
public class DrpAuthorityApi {
   public static final String DRP_DEVICE_NOT_BIND_AREA = "drp.device-not-bind-area";

   @Resource
   private DrpSupplierMapper drpSupplierMapper;

   @Resource
   private MgrAuthApi mgrAuthApi;




   public Long listSupplierAuthority() {
     // Long userId = (Long)SecureManager.getSubjectId().get();
      Long userId = 0L;
      DrpSupplierVO drpSupplierVO = this.drpSupplierMapper.listSupplierByUserId(userId);
      return ObjectUtil.isEmpty(drpSupplierVO) ? -1L : drpSupplierVO.getSupplierId();
   }

//   public List<Long> authAreaList(List<Long> areaIdList) {
//      if (this.mgrAuthApi.isSuperAdmin()) {
//         return areaIdList;
//      } else {
//         List<Long> authArea = this.mgrAuthApi.getTenantAreaIdList();
//         if (CollUtil.isEmpty(areaIdList)) {
//            return authArea;
//         } else {
//            authArea.retainAll(areaIdList);
//            return (List)(CollUtil.isEmpty(authArea) ? CollUtil.newArrayList(new Long[]{-1L}) : authArea);
//         }
//      }
//   }


}
