package com.cm.common.plugin.oauth.service.user;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cm.common.exception.AccessTokenException;
import com.cm.common.exception.SearchException;
import com.cm.common.plugin.pojo.bos.UserResourceBO;
import com.cm.common.plugin.pojo.bos.user.UserDepartmentResourceBO;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultLayImData;
import com.cm.common.result.SuccessResultList;
import org.aspectj.lang.annotation.DeclareError;

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

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: IUserService
 * @Description: 用户
 * @Author: WangGeng
 * @Date: 2019-07-29 21:23
 * @Version: 1.0
 **/
public interface IUserService {
    /**
     * 组织部门人员列表
     *
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    @Deprecated
    JSONArray listDepartmentUsers(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 角色人员列表
     *
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    @Deprecated
    JSONArray listRoleUsers(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 组人员列表
     *
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    @Deprecated
    JSONArray listGroupUsers(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 职位人员列表
     *
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    @Deprecated
    JSONArray listPositionUsers(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 全部用户
     *
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    @Deprecated
    JSONArray listAllUsers(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 获取用户所在部门用户列表
     *
     * @param userParams
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    @Deprecated
    JSONArray listUserDepartmentUser(Map<String, Object> userParams) throws AccessTokenException, SearchException;

    /**
     * 获取用户所在部门用户列表（通过角色）
     *
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    @Deprecated
    JSONArray listUserDepartmentUserByRole(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * APP获取用户所在部门用户列表（通过角色）
     *
     * @param token
     * @param userParams
     * @return
     */
    @Deprecated
    JSONArray listUserDepartmentUserByRole(String token, Map<String, Object> userParams) throws SearchException;

    /**
     * 获取用户所在部门用户列表（通过职位）
     *
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    @Deprecated
    JSONArray listUserDepartmentUserByPosition(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 用户详情接口
     *
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    @Deprecated
    JSONObject getUserDetail(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 角色用户列表
     *
     * @param accessToken
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    @Deprecated
    JSONArray listRoleUsers(String accessToken, Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 查询密码状态
     *
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    JSONObject getPasswordStatus() throws AccessTokenException, SearchException;

    /**
     * 更新用户密码
     *
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    SuccessResult updateUserPassword(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 通过用户和部门ID列表获取部门用户列表
     *
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    JSONArray listDepartmentUserByUserDepartmentId(JSONObject params) throws AccessTokenException, SearchException;

    /**
     * 获取所有用户列表（通过上级区域ID）
     *
     * @param params，1级区域到5级区域，area1, area2, area3, area4, area5
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    List<UserResourceBO> listUserAllByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 获取所有用户ID列表（通过上级区域ID）
     *
     * @param params，1级区域到5级区域，area1, area2, area3, area4, area5
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    List<String> listUserIdAllByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 获取用户列表（通过上级区域ID）
     *
     * @param params，1级区域到5级区域，area1, area2, area3, area4, area5
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    List<UserResourceBO> listUserByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 获取用户列表（通过上级区域ID）
     *
     * @param params 1级区域到5级区域，area1, area2, area3, area4, area5
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    List<String> listUserIdByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 用户列表（简单格式）
     *
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    SuccessResultList<List<UserResourceBO>> listPageUserSimple(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 用户列表（通过用户Id列表）
     *
     * @param userIds
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    List<UserResourceBO> listUserResourceByIds(List<String> userIds) throws AccessTokenException, SearchException;

    /**
     * 用户列表
     *
     * @param usernames 用户名列表
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    List<UserResourceBO> listUserResourceByUsernames(List<String> usernames) throws AccessTokenException, SearchException;

    /**
     * 用户动态详情列表（通过id列表）
     *
     * @param userIds
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    JSONArray listDynamicUserInfoByIds(List<String> userIds) throws AccessTokenException, SearchException;

    /**
     * 用户详情
     *
     * @param userId
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    JSONObject getDynamicUserInfoByUserId(String userId) throws AccessTokenException, SearchException;


    /**
     * 获取用户（通过ID）
     *
     * @param userId
     * @return
     * @throws SearchException
     */
    UserDepartmentResourceBO getUserDepartmentResourceById(String userId) throws SearchException;

    /**
     * 获取用户列表（通过ID）
     *
     * @param userIds
     * @return
     * @throws SearchException
     */
    List<UserDepartmentResourceBO> listUserDepartmentResourceByIds(List<String> userIds) throws SearchException;

    /**
     * 获取用户列表（通过部门ID列表）
     *
     * @param departmentIds
     * @return
     * @throws SearchException
     */
    List<UserDepartmentResourceBO> listUserDepartmentResourceByDepartmentIds(List<String> departmentIds) throws SearchException;

    /**
     * 获取所在部门用户列表（通过用户ID和角色ID列表）
     *
     * @param userId
     * @param roleIds
     * @return
     * @throws SearchException
     */
    List<UserDepartmentResourceBO> listUserDepartmentResourceByUserIdAndRoleIds(String userId, List<String> roleIds) throws SearchException;

    /**
     * 获取所在部门用户列表（通过角色ID列表）
     *
     * @param roleIds
     * @return
     * @throws SearchException
     */
    List<UserDepartmentResourceBO> listUserDepartmentResourceByRoleIds(List<String> roleIds) throws SearchException;

    /**
     * 获取所在部门用户列表（通过用户ID和职位ID列表）
     *
     * @param userId
     * @param positionIds
     * @return
     * @throws SearchException
     */
    List<UserDepartmentResourceBO> listUserDepartmentResourceByUserIdAndPositionIds(String userId, List<String> positionIds) throws SearchException;

    /**
     * 获取所在部门用户列表（通过职位ID列表）
     *
     * @param positionIds
     * @return
     * @throws SearchException
     */
    List<UserDepartmentResourceBO> listUserDepartmentResourceByPositionIds(List<String> positionIds) throws SearchException;

    /**
     * 获取选择的部门用户（插件用）
     *
     * @param params
     * @return
     * @throws SearchException
     */
    JSONArray listSelectDepartmentUser(String departmentId) throws AccessTokenException, SearchException;

    /**
     * 组织部门人员分页列表（插件用）
     *
     * @param departmentId
     * @param page
     * @return
     * @throws SearchException
     */
    JSONObject listPageSelectDepartmentUserByDepartmentId(String departmentId, ListPage page) throws AccessTokenException, SearchException;

    /**
     * 通过id列表获取用户ID（插件用）
     *
     * @param params
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    JSONArray listUserByIds(Map<String, Object> params) throws AccessTokenException, SearchException;

    /**
     * 用户资源列表
     *
     * @param keywords 关键字
     * @return
     * @throws AccessTokenException
     * @throws SearchException
     */
    List<UserResourceBO> listResourceByKeywords(String keywords) throws AccessTokenException, SearchException;

}
