package com.fs.qw.service;

import com.fs.common.core.domain.R;
import com.fs.company.vo.OptionVO;
import com.fs.qw.domain.QwUser;
import com.fs.qw.param.*;
import com.fs.qw.vo.QwHookAuthVO;
import com.fs.qw.vo.QwOptionsVO;
import com.fs.qw.vo.QwUserVO;
import com.fs.qw.vo.UserVOs;

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

/**
 * 企微用户Service接口
 *
 * @author fs
 * @date 2024-06-20
 */
public interface IQwUserService
{
    /**
     * 查询企微用户
     *
     * @param id 企微用户主键
     * @return 企微用户
     */
    public QwUser selectQwUserById(Long id);
    public R authAppKey(QwUser param);
    public R handleInputAuthAppKey(QwUser param);
    public R loginQwCode(QwLoginParam loginParam);
    public R loginQwAll();
    public R qwLoginOutAll();
    public R loginQwCodeUrl(QwLoginParam loginParam);
    public R getQwCodeUrl(QwLoginParam loginParam) throws InterruptedException;
    public R loginQwCodeMsg(QwLoginParam loginParam);
    public R logoutQwLogout(QwLoginParam loginParam);
    public R modifyLoginQwStatus(QwLoginParam loginParam);
    public R getLoginQwStatus(QwLoginParam loginParam);
    public R qwBindCloudHost(String appKey);
    public R selectCloudAP(QwCloudAPParam param) throws Exception;
    public R qwBindCloudHostByIp(String appKey,String IP);
    public R qwBindCloudHostByIp2(String appKey,String IP,List<String> appkeyList, List<String> appkeyUnNow);
    public R qwUnbindCloudHost(String appKey);

    public int updateQwUserByAppKey(QwUser qwUser);
    public int updateQwUserByAppKeyTool(QwUser qwUser);
    /**
     * 查询企微用户列表
     *
     * @param qwUser 企微用户
     * @return 企微用户集合
     */
    public List<QwUser> selectQwUserList(QwUser qwUser);

    /**
     * 新增企微用户
     *
     * @param qwUser 企微用户
     * @return 结果
     */
    public int insertQwUser(QwUser qwUser);

    /**
     * 修改企微用户
     *
     * @param qwUser 企微用户
     * @return 结果
     */
    public int updateQwUser(QwUser qwUser);

    /**
     * 批量删除企微用户
     *
     * @param ids 需要删除的企微用户主键集合
     * @return 结果
     */
    public int deleteQwUserByIds(Long[] ids);

    /**
     * 删除企微用户信息
     *
     * @param id 企微用户主键
     * @return 结果
     */
    public int deleteQwUserById(Long id);

    /**
     * 查询绑定了的企微用户列表
     */
    List<QwUserVO> selectQwUserListVO(QwUserListParam qwUser);
    List<QwUserVO> selectQwUserListStaffVO(QwUserListParam qwUser);
    /**
    *  查询所有企微用户列表
    */
    List<QwUserVO> selectQwUserListBindVO(QwUserParam qwUser);

    R syncQwUser(String corpId);

    List<QwOptionsVO> selectQwUserListOptionsVO(String corpId);

    /** 修改企微用户的欢迎语 */
    R weclomeQwUser(QwUser qwUser) throws Exception;

    QwUser selectQwUserByQwUserId(String qwUserId);


    void updateUserByUserId(Long companyUserId);
    void updateUnBindUserById(String id);

    List<QwOptionsVO> selectQwUserListOptionsVOByCompanyUserId(Long userId);

    QwUser selectQwUserByAppKey(String key);

    String selectQwUserByQwUserIdAndCorId(String cropId, String QwUserId);

    QwHookAuthVO selectQwUserByAppKeyAuth(String key);

    List<QwOptionsVO> selectQwCompanyListOptionsVOByCompanyId(Long companyId);

//    QwUser selectQwUserByQwHookId(String sender);

    R relieveFastGptRoleById(Long id);

    List<QwUserVO> selectAllQwUserListVO(QwUserListParam qwUser);

    QwUserVO selectQwUserVOById(Long id);
    List<QwUserVO> selectQwUserVOByIds(Long[] ids);

    List<QwOptionsVO> selectQwCompanyListAllOptionsVO();

    List<QwOptionsVO> getQwUserAll();

    R syncQwUserName(String string);

    Long getQwUserCompanyId(String corpId, String qwUserid);


    void addRedisKey(String id, String key);

    /**
     * 根据企微用户ID和企微ID查询企微用户记录
     * @param qwUserId  企微用户ID
     * @param corpId    企微ID
     * @return  QwUser
     */
    QwUser getByQwUserIdAndCorId(String qwUserId, String corpId);

    R selectCloudByCompany(Long companyId, Long userId);

    List<UserVOs> getUserList(Long userId);

    /**
     * 查询企微用户列表
     * @param params    条件
     * @return  list
     */
    List<OptionVO> selectQwUserListByMap(Map<String, Object> params);

    R loginQwIpad(QwLoginHookParam loginParam);

    R qrCodeStatus(QwLoginHookParam loginParam);

    R qrCodeVerify(QwLoginHookParam loginParam);

    R outLoginQwIpad(QwLoginHookParam loginParam);

    R getTwoCode(QwLoginHookParam loginParam);

    R getTwoCodeStatus(QwLoginHookParam loginParam);

    R getQwIpad(QwLoginHookParam loginParam);

    R delQwIpad(QwLoginHookParam loginParam);

    R allocateRemoteHost(QwLoginHookParam loginParam);

    List<UserVOs> getQwUserList(Long userId, String qwUserId);
}
