package net.northking.cctp.device.api.activity.service;

import net.northking.cctp.common.db.Pagination;
import net.northking.cctp.common.http.QueryByPage;
import net.northking.cctp.device.db.entity.CdDeviceToken;
import net.northking.cctp.device.db.entity.CdDeviceUsageLog;
import net.northking.cctp.device.dto.device.*;
import net.northking.cctp.device.dto.pcDevice.CdDeviceRemoteDto;
import net.northking.cctp.device.dto.pcDevice.CdPcDeviceExitDto;
import net.northking.cctp.device.dto.pcDevice.CdPcDeviceRemoteDto;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
import java.util.Set;


public interface DeviceActivityApiService {

    DeviceInfoDto getInfoFromToken(String token);

    Boolean checkToken(DeviceLockDto dto);

    Pagination<CdDeviceUsageLog> getUsageLog(QueryByPage<DeviceLogDto> dto);

    DeviceInfoDto pubGetInfo(String uuid);

    List<Map<String,Object>> checkDeviceStatus(List<String> deviceIds);

    List<Map<String,Object>> queryDeviceInfo(Set<String> deviceList);

    Map<String,Object> queryMobDevicePlatform(List<String> deviceIds);

    List<Map<String,String>> deviceListApply(Map<String,Object> map,HttpServletRequest request);

    String queryDeviceToken(String deviceId);

    CdPcDeviceRemoteDto scriptPcDevice(CdDeviceRemoteDto dto, String projectId, HttpServletRequest request);

    DeviceInfoDto scriptMobDevice(CdDeviceRemoteDto dto, String projectId, HttpServletRequest request);

    void releaseDeviceList(Map<String,Object> map);

    String releasePcDevice(CdPcDeviceExitDto dto);

    String releaseMobDevice(CdMobileDeviceExitDto dto);

    Map<String,List<String>> queryDeviceType(List<String> deviceIds);

    /**
     * 释放设备
     * @param token 设备token
     * @return true or false
     */
    Boolean deviceRelease(String token);

    /**
     * 释放引擎绑定的所有设备
     * @param deviceTokens 设备token信息
     */
    void release(List<CdDeviceToken> deviceTokens);

    /**
     * 批量申请设备
     * @param devices
     * @param request
     * @return
     */
    List<ApplyDeviceDto> deviceListApply(BatchApplyDeviceDto devices, HttpServletRequest request);

}
