package com.yuchen.saas.park.service.service.pldoor;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yuchen.saas.park.api.dto.pldoor.PlDoorUserPointSetDTO;
import com.yuchen.saas.park.api.entity.pldoor.PlDoorPoint;
import com.yuchen.saas.park.api.entity.pldoor.PlDoorUserPointSet;
import com.yuchen.saas.park.api.vo.pldoor.PlDoorUserPointSetVO;
import com.yuchen.saas.park.api.vo.request.PlDoorUserPointSetReq;
import org.apache.ibatis.annotations.Param;

import java.io.UnsupportedEncodingException;
import java.util.List;

/**
 * <p>
 * 人员登记配置 服务类
 * </p>
 *
 * @author miaoqs
 * @since 2024-04-08
 */
public interface PlDoorUserPointSetService extends IService<PlDoorUserPointSet> {

    boolean saveOrUpdateByParam(PlDoorUserPointSetDTO plDoorUserPointSetDTO);

    /**
     * 分页查询
     * @param page
     * @param req
     * @return
     */
    IPage<PlDoorUserPointSetVO> pageByparam(Page<PlDoorUserPointSetReq> page, @Param("req") PlDoorUserPointSetReq req);

    /**
     * 获取详情
     * @param id
     * @return
     */
    PlDoorUserPointSetVO getDetailById(Long id);

    /**
     * 移除
     * @param id
     * @return
     */
    boolean removePointSetById(Long id);

    /**
     * 仅移除人脸和二维码权限
     * @param id
     * @return
     */
    boolean removeFaceByPointSetId(Long id);


    /**
     * 综合查询
     * @param page
     * @param req
     * @return
     */
    IPage<PlDoorUserPointSetVO> pageByPower(Page<PlDoorUserPointSetReq> page, PlDoorUserPointSetReq req);

    /**
     * 发送人员权限
     * @param id
     * @return
     */
    boolean sendUserPower(Long id);

    /**
     * 检测人脸图片是否合格
     * @param pointId
     * @param faceUrl
     * @return
     */
    boolean chenkFace(Long pointId, String faceUrl);

    /**
     * 远程开门
     * @param userId, pointId
     * @param userId
     * @return
     */
    boolean doorOperation(Long userId, Long pointId);

    /**
     * 机器人远程开门接口 by robotSn,pointId
     * @param robotSn
     * @param pointId
     * @return
     */
    boolean openDoorForMcRobot(String robotSn, Long parkId, Long pointId);

    /**
     * 获取人员门禁点列表
     * @param userId
     * @return
     */
    List<PlDoorPoint> getUserPointList(Long userId);

    /**
     * 获取用户权限二维码
     * @param userId
     * @return
     * @throws UnsupportedEncodingException
     */
    String getUserQrcode(Long userId) throws UnsupportedEncodingException;

    boolean testUserQrcode();

    List<PlDoorPoint> getUserPowerList(Long parkId, Long userId);

    /**
     * 检查门禁点权限是否过期
     */
    void checkPointPermission();

    /**
     * 铁军语音播报
     * @param voiceStr
     */
    boolean tiejunVoice(String voiceStr, Long parkId, Long pointId);
}
