package com.hz.pm.api.common.helper;

import cn.hutool.core.util.NumberUtil;
import com.hz.pm.api.user.model.entity.UserInfo;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.ningdatech.basic.util.CollUtils;

import java.util.Collection;
import java.util.List;

/**
 * @author liuxinxin
 * @date 2023/2/10 下午4:38
 * @Description: 用户信息管理工具类 helper
 */

public interface UserInfoHelper {

    UserFullInfoDTO getUserFullInfoByMhUserIdOrOpenId(String mhUserId);

    UserFullInfoDTO getUserFullInfo(Long userId);

    default UserFullInfoDTO getUserFullInfo(String userId) {
        if (NumberUtil.isLong(userId)) {
            return getUserFullInfo(Long.parseLong(userId));
        }
        return null;
    }

    UserFullInfoDTO getUserFullInfo(UserInfo userInfo);

    List<UserFullInfoDTO> getUserFullInfos(List<UserInfo> userInfos);

    String getUserName(Long userId);

    /**
     * 判断该用户是否是区管或者超管 \
     *
     * @return \
     */
    boolean isSuperOrRegionAdmin(Long userId);

    List<UserFullInfoDTO> listUserFullInfoByUserIds(Collection<Long> userIds);

    default List<UserFullInfoDTO> listUserFullInfoByUserIds(List<String> userIds){
        List<Long> userIdsLong = CollUtils.convert(userIds, Long::parseLong);
        return listUserFullInfoByUserIds(userIdsLong);
    }

}
