package com.cm.smartgate.service;

import com.alibaba.fastjson.JSONObject;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.smartgate.pojo.dtos.SmartGateDTO;
import com.cm.smartgate.pojo.dtos.check.SmartGateCheckResultDTO;
import com.cm.smartgate.pojo.vos.SmartGateVO;
import com.cm.smartgate.pojo.vos.check.SmartGateCheckVO;
import net.sf.jsqlparser.statement.update.Update;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: ISmartGateService
 * @Description: 智慧闸机
 * @Author: WangGeng
 * @Date: 2020/8/27 9:42
 * @Version: 1.0
 **/
public interface ISmartGateService {

    /**
     * 新增智慧闸机
     *
     * @param smartGateVO
     * @return
     * @throws Exception
     */
    SuccessResult saveSmartGate(SmartGateVO smartGateVO) throws Exception;

    /**
     * 删除智慧闸机(id列表)
     *
     * @param ids
     * @return
     * @throws RemoveException
     */
    SuccessResult removeSmartGate(String ids) throws RemoveException;

    /**
     * 修改智慧闸机
     *
     * @param smartGateId
     * @param smartGateVO
     * @return
     * @throws Exception
     */
    SuccessResult updateSmartGate(String smartGateId, SmartGateVO smartGateVO) throws Exception;

    /**
     * 修改开门模式
     *
     * @param smartGateId
     * @param doorMode
     * @return
     * @throws UpdateException
     */
    SuccessResult updateDoorMode(String smartGateId, Integer doorMode) throws UpdateException;

    /**
     * 修改通行模式
     *
     * @param smartGateId
     * @param generalMode
     * @return
     * @throws UpdateException
     */
    SuccessResult updateGeneralMode(String smartGateId, Integer generalMode) throws UpdateException;

    /**
     * 修改认证模式
     *
     * @param smartGateId
     * @param trustMode
     * @return
     * @throws UpdateException
     */
    SuccessResult updateTrustMode(String smartGateId, Integer trustMode) throws UpdateException;

    /**
     * 智慧闸机详情(通过ID)
     *
     * @param smartGateId
     * @return
     * @throws SearchException
     */
    SmartGateDTO getSmartGateById(String smartGateId) throws SearchException;

    /**
     * 智慧闸机设备(通过serialNo)
     *
     * @param smartGateSerialNo
     * @return
     * @throws SearchException
     */
    SmartGateDTO getSmartGateBySerialNo(String smartGateSerialNo) throws SearchException;

    /**
     * 检查智慧闸机设备编码(通过serialNo)
     *
     * @param smartGateSerialNo
     * @return
     * @throws SearchException
     */
    SuccessResultData<String> checkSmartGateBySerialNo(String smartGateSerialNo) throws SearchException;

    /**
     * 检查智慧闸机设备编码(通过smartGateId, serialNo)
     *
     * @param smartGateId
     * @param smartGateSerialNo
     * @return
     * @throws SearchException
     */
    SuccessResultData<String> checkSmartGateBySerialNo(String smartGateId, String smartGateSerialNo) throws SearchException;

    /**
     * 智慧闸机列表
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<SmartGateDTO> listSmartGate(Map<String, Object> params) throws SearchException;

    /**
     * 智慧闸机分页列表
     *
     * @param page
     * @return
     * @throws SearchException
     */
    SuccessResultList<List<SmartGateDTO>> listPageSmartGate(ListPage page) throws SearchException;

    /**
     * 智慧闸机统计
     *
     * @param params
     * @return
     * @throws SearchException
     */
    SuccessResultData<Integer> countSmartGate(Map<String, Object> params) throws SearchException;

    /**
     * 心跳检测
     *
     * @param serialNo
     * @return
     */
    SuccessResult heartbeat(String serialNo);

    /**
     * 通过校验闸机身份证获取开门状态
     *
     * @param smartGateCheckVO
     * @param picture
     * @return
     * @throws SearchException
     */
    JSONObject getOpenDoorStateCheckByIdCard(SmartGateCheckVO smartGateCheckVO, MultipartFile picture) throws SearchException;

    /**
     * 开门(通过ID)
     *
     * @param smartGateId
     * @return
     * @throws SearchException
     */
    SuccessResult getOpenDoorById(String smartGateId) throws SearchException;
}
