package com.usky.iot.service;

import com.usky.backend.domain.*;
import com.usky.common.core.bean.CommonPage;
import com.usky.common.mybatis.core.CrudService;
import com.usky.demo.domain.LastInnerQueryVO;
import com.usky.iot.domain.DmpDeviceInfo;
import com.usky.iot.service.vo.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;


/**
 * <p>
 * 设备信息表
 * </p>
 *
 * @author ya
 * @since 2022-10-08
 */
public interface DmpDeviceInfoService extends CrudService<DmpDeviceInfo> {

    void add(DmpDeviceInfo dmpDeviceInfo);

    void update(DmpDeviceInfo dmpDeviceInfo);

    boolean checkNameUnique(DmpDeviceInfo dmpDeviceInfo);

    boolean checkNameUnique1(DmpDeviceInfo dmpDeviceInfo,Integer tenantId);

    void deviceStatus();

    void updateDeviceStatus(LastInnerQueryVO queryVO);

    CommonPage<DmpDeviceInfo> page(DmpDeviceInfoRequest dmpDeviceInfoRequest);

    CommonPage<DmpDeviceInfo> pageWhite(DmpDeviceInfoRequest dmpDeviceInfoRequest);

    List<DmpDeviceInfo> gatewayDeviceList();

    boolean remove(Integer id);

    /**
     * 设备状态统计
     * @return
     */
    List<Map<String,Object>> deviceCollect(List<Integer> productIds);

    /**
     * 设备总数
     * @param productId
     * @return
     */
    int deviceCountByProductId(Integer productId);

    void addByFile(MultipartFile multipartFiles);

    void importDeviceInfo(List<DmpDeviceInfo> list);

    /**
     * 导出
     * @param dmpDeviceInfoRequest
     */
    void export(DmpDeviceInfoRequest dmpDeviceInfoRequest, HttpServletResponse response);

    /**
     * 网关设备配置查询
     * @param gatewayDeviceInfoRequestVO
     */
    Map<String, Map<String, GatewayDeviceExportItemVO>> gatewayExport(GatewayDeviceInfoRequestVO gatewayDeviceInfoRequestVO);

    CommonPage<Object> deviceCurrentDataList(String deviceName,String installAddress,String productCode,Integer pageNum,Integer pageSize);

    CommonPage<DataTVResponseVO> dataTVList(DataTVRequestVO requestVO);

    List<DataTVStatisticResponseVO> dataTVStatistic(DataTVRequestVO requestVO);

    List<Map<String,Object>> deviceDataTotal(DataTotalRequestVO requestVO);
    List<DataAverageResponseVO> deviceDataAverage(DataAverageRequestVO requestVO);
    List<DataAverageExportVO> DataAverageExport(DataAverageRequestVO requestVO);

    Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName, Integer categoryType, String gatewayUuid);

    /**
     * @description: 获取设备topic列表
     * @author: fyc
     * @email yuchuan.fu@chinausky.com
     * @date: 2025/2/7 17:49
     * @param: [pageNum, pageSize]
     * @return: java.util.List<com.usky.iot.service.vo.DmpTopicResponseVO>
     **/
    CommonPage<DmpTopicResponseVO> topic(DmpTopicRequestVO requestVO);

    /**
     * @description: 获取设备告警请求信息
     * @author: fyc
     * @email yuchuan.fu@chinausky.com
     * @date: 2025/2/7 17:49
     * @param: [deviceId, productCode]
     * @return: com.usky.iot.service.vo.DmpHttpAlarmResponseVO
     **/
    DmpHttpAlarmResponseVO alarmResponse(String deviceId, String productCode);
}
