package com.mortals.xhx.module.device.service;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.common.code.DeviceMethodEnum;
import com.mortals.xhx.module.device.dao.DeviceDao;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceMapEntity;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.queue.TbQueueCallback;
import com.mortals.xhx.queue.TbQueueMsgHeaders;
import com.mortals.xhx.queue.TopicPartitionInfo;

import java.util.List;

/**
* DeviceService
*
* 设备 service接口
*
* @author zxfei
* @date 2022-03-09
*/
public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{


    ApiResp<String> sendDeviceMessage(DeviceEntity deviceEntity, TopicPartitionInfo info, TbQueueMsgHeaders header, String message, TbQueueCallback callback , Context context);

    ApiResp<String> sendDeviceMessage(List<Long> deviceIds, TopicPartitionInfo info,TbQueueMsgHeaders header, String message , Context context);


    /**
     * 设备激活
     * @param deviceCode
     * @param context
     */
    void active(String deviceCode,Context context);

    /**
     * 设备启用停用
     * @param id
     * @param context
     */
    void deviceEnabled(Long id,Integer status,Context context);
    void stopOrStartComsumeQueue(Long id,Integer status,Context context);



    void sendThirdParty(DeviceEntity entity, ProductEntity productEntity, PlatformEntity platformEntity, DeviceMethodEnum update);


    void putCache(String key,DeviceEntity deviceEntity);

    DeviceDao getDeviceDao();

    /**
     * 设备统计当天情况
     * @param context
     */
    void deviceStat(Long siteId,Context context);

    List<DeviceMapEntity> deviceMap(DeviceEntity query, Context context);



}