package com.fs.qw.service;

import com.fs.common.core.domain.R;
import com.fs.qw.domain.QwUser;
import com.fs.qw.domain.QwWorkTask;
import com.fs.qw.dto.QwUserKeyDTO;
import com.fs.qw.param.*;
import com.fs.qw.vo.*;
import com.fs.sop.domain.QwSop;

import java.util.List;

/**
 * 企微用户Service接口
 *
 * @author fs
 * @date 2024-06-20
 */
public interface IQwUserService
{
    /**
     * 查询企微用户
     *
     * @param id 企微用户主键
     * @return 企微用户
     */
    public QwUser selectQwUserById(Long id);
    public List<QwUser> batchGetQwUser(List<QwUserKeyDTO> qwUserId);
    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 selectCloudByCompany(Long companyId,Long userId) 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);

    R unlockQwUserLoginCodeUrlTask();

    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);

    QwUser getByQwUserIdAndCorId(String qwUserId, String corpId);

    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);

    List<QwWorkTask> selectQwWorkTaskList(SelectQwWorkTaskListParam param);

    List<String> selectQwUserListByCompanyUserId(Long userId,String corpId );
    List<Long> selectQwUserListByCuDeptIdList(QwSop qwSop);


    /**
     * 重启云主机
     * @param IP 服务器ip
     * @return
     */
    R restartCloudHost(String IP);

    /**
     * 获取企微用户信息
     * @param param 查询参数
     * @return list
     * **/
    List<QwUser> getQwUserInfo(QwFsUserParam param);

    List<UserVOs> getUserList(Long userId);

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

    R updateSendType(UpdateSendTypeVo vo);

    R getLoginQwIpadStatus(QwLoginHookParam loginParam);

    void atMsg(QwUser qwUser, String s);

    void changeVideoStatus(Long id);

    /**
     * 根据销售公司和企微ID查询企微用户
     */
    List<QwUserVO> selectQwUserListByCompanyIdAndCorpIdAndNickName(Long companyId, String corpId, String nickName);

    List<QwOptionsVO> selectQwCompanyListOptionsVOBySys();

    List<Long> selectDeptByParentId(Long deptId,String cropId);
}
