package com.yida.data.attendance.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.attendance.dto.DevicePage;
import com.yida.data.attendance.dto.IssuedFaceDTO;
import com.yida.data.attendance.dto.RemoveFaceDTO;
import com.yida.data.attendance.vo.DeviceNumberVO;
import com.yida.data.attendance.vo.DeviceVO;
import com.yida.data.attendance.vo.OnlineCountVO;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.CurrentUser;
import com.yida.data.common.core.entity.attendance.EduAttendanceDevice;
import com.yida.data.common.core.entity.constant.FebsConstant;

import java.util.List;

import org.springframework.scheduling.annotation.Async;

public interface EduAttendanceDeviceService extends IService<EduAttendanceDevice> {

    DevicePage<DeviceVO> listDevicePage(DevicePage page, String schoolName, String number,
                                        Integer scope, Integer type, Integer state, CurrentUser currentUser);

    EduAttendanceDevice saveDevice(EduAttendanceDevice device);

    /**
     * 批量开门
     *
     * @param list
     */

    void openAllDoor(List<String> list);

    /**
     * 批量设置时间
     *
     * @param list
     */

    void setAllTime(List<String> list);

    /**
     * 远程开门
     *
     * @param id
     */
    void openDoor(String id);

    /**
     * 设置时间
     *
     * @param id
     */
    void setSysTime(String id);

    /**
     * 下发人脸,异步调用 防止超时
     */
    @Async(FebsConstant.ASYNC_POOL)
    void issuedFace(IssuedFaceDTO dto);

    /**
     * 删除设备中的人脸
     */
    @Async(FebsConstant.ASYNC_POOL)
    void removeFace(RemoveFaceDTO dto);

    /**
     * 检测在线设备
     */
    void updateDeviceStatus();

    /**
     * 考勤设备数量统计
     *
     * @return com.yida.data.common.core.common.ResultBean<com.yida.data.attendance.vo.DeviceNumberVO>
     * @author ZYJ
     * @date 2021/10/8 17:14
     */
    ResultBean<DeviceNumberVO> findDeviceNumber() throws NoSuchMethodException;

    /**
     * 校时所有设备
     */
    @Async(FebsConstant.ASYNC_POOL)
    void timingAllDevice();

    /**
     * 获取面板机状态分布
     *
     * @return
     */
    OnlineCountVO getOnlineDistrib(List<Long> schoolIds);

    /**
     * 删除设备信息
     *
     * @param ids 设备id集合
     * @author ZYJ
     * @date 2023/10/23 15:34
     */
    void delDevice(List<Long> ids);
}
