/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.dm.device.service;

import me.zhengjie.modules.dm.device.domain.DmDevice;
import me.zhengjie.modules.dm.device.service.dto.DmDeviceDto;
import me.zhengjie.modules.dm.device.service.dto.DmDeviceQueryCriteria;
import me.zhengjie.modules.dm.printingRequest.service.dto.DmPrintingRequestQueryCriteria;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

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

/**
* @website https://el-admin.vip
* @description 服务接口
* @author xwx
* @date 2021-03-12
**/
public interface DmDeviceService {

    /**
     * 查询数据分页
     *
     * @param criteria 条件
     * @param pageable 分页参数
     * @return Map<String , Object>
     */
    Map<String, Object> queryAll(DmDeviceQueryCriteria criteria, Pageable pageable);

    /**
     * 查询所有数据不分页
     *
     * @param criteria 条件参数
     * @return List<DmDeviceDto>
     */
    List<DmDeviceDto> queryAll(DmDeviceQueryCriteria criteria);

    /**
     * 查询所有数据不分页
     *
     * @param
     * @return List<DmDeviceDto>
     */
    List<DmDeviceDto> queryAll();

    /**
     * 根据ID查询
     *
     * @param id ID
     * @return DmDeviceDto
     */
    DmDeviceDto findById(Long id);

    /**
     * 创建
     *
     * @param resources /
     * @return DmDeviceDto
     */
    DmDeviceDto create(DmDevice resources);

    /**
     * 编辑
     *
     * @param resources /
     */
    void update(DmDevice resources);

    /**
     * 多选删除
     *
     * @param ids /
     */
    Map<String,Object> deleteAll(Long[] ids);

    /**
     * 导出数据
     *
     * @param all      待导出的数据
     * @param response /
     * @throws IOException /
     */
    void download(List<DmDeviceDto> all, HttpServletResponse response) throws IOException;

    Map<String,Object> selectList(DmDeviceQueryCriteria criteria, Pageable pageable);

    /**
     * 查询最大的code
     *
     * @return
     */
    String getMaxCode();

    DmDeviceDto findInfo(Long id);

    /**
     * 首页设备信息
     */
    Map<String,Object> firstDevice();

    /**
     * 查询设备运行趋势
     * @return
     */
    List<Map<String,String>> YunDeviceRequest();

    /**
     * 设备打印任务
     * @param
     * @param pageable
     * @return
     */
    Map<String,Object> selectDevice (String buildStateDate, String buildEndDate, Pageable pageable);

    /**
     * 打印设备列表(运营)
     * @param
     * @return
     */
    List<Map<String,Object>> deviceList ();

    /**
     * 打印设备详情(运营)
     * @param
     * @return
     */
    Map<String,Object> deviceDetail (Long deviceId);

    /**
     * 查询设备数量
     * @return
     */
    Long findDeviceCount();

    /**
     * 根据读卡器ip修改打印机状态
     *
     * @param cardIp /
     * @param status /
     */
    void updateStatus(String cardIp, String status);
}
