package jnpf.authority.fallback;

import jnpf.authority.FtbAuthorityApi;
import jnpf.base.ActionResult;
import jnpf.base.vo.PageListVO;
import jnpf.model.authority.dto.menu.FunctionMenuRemoteDTO;
import jnpf.model.authority.dto.menu.FuntionMenuDTO;
import jnpf.model.authority.dto.permission.OrganizeWithPositionsDTO;
import jnpf.model.authority.dto.role.FtbPermissionRoleInfoDTO;
import jnpf.model.authority.vo.person.FtbRoleListDropDownVO;
import jnpf.model.authority.vo.role.FtbPermissionRoleIdentificationVO;
import jnpf.model.authority.vo.role.FtbPermissionRoleInfoVO;
import jnpf.model.cultivate.CultivatePage;
import jnpf.model.cultivate.vo.common.InnerPowerPositionVO;
import jnpf.model.cultivate.vo.common.InnerPowerUserVO;
import jnpf.model.login.MenuTreeVO;
import jnpf.permission.dto.v2.user.QueryPageUserDTO;
import jnpf.permission.dto.v2.user.QueryPageUserMoreKeywordDTO;
import jnpf.permission.eum.v2.OrganizeCategoryEnums;
import jnpf.permission.eum.v2.UserWorkStatusEnums;
import jnpf.permission.vo.organize.OrganizeAndPositionListVO;
import jnpf.permission.vo.store.StoreBaseListInfo;
import jnpf.permission.vo.v2.TargetAuthIdsVO;
import jnpf.permission.vo.v2.organzie.OrganizeGeneralDetailVO;
import jnpf.permission.vo.v2.organzie.OrganizeManagerFilterNodeVO;
import jnpf.permission.vo.v2.organzie.OrganizeManagerNodeVO;
import jnpf.permission.vo.v2.position.PositionListUserVO;
import jnpf.permission.vo.v2.user.UserBoundVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

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

@Slf4j
@Component
public class FtbAuthorityApiFallback implements FallbackFactory<FtbAuthorityApi> {

    @Override
    public FtbAuthorityApi create(Throwable cause) {
        cause.printStackTrace();
        return new FtbAuthorityApi() {
            @Override
            public Map<String, String> queryUserScopeOfPermission(String userId) {
                log.error("queryUserScopeOfPermission 调用失败...");
                return null;
            }

            @Override
            public List<StoreBaseListInfo> authStoreBaseListInfo() {
                return List.of();
            }

            @Override
            public List<UserBoundVO> listTargetOrganizeIdAuthApi(String organizeId, List<UserWorkStatusEnums> userWorkStatusEnumsList) {
                return List.of();
            }

            @Override
            public List<UserBoundVO> listTargetOrganizeIdsAuthApi(List<String> organizeIds, List<UserWorkStatusEnums> userWorkStatusEnumsList) {
                return List.of();
            }

            @Override
            public ActionResult<PageListVO<UserBoundVO>> pagePost(QueryPageUserDTO dto) {
                return null;
            }

            @Override
            public ActionResult<PageListVO<UserBoundVO>> pagePostMoreKeyword(QueryPageUserMoreKeywordDTO dto) {
                return null;
            }

            @Override
            public ActionResult<List<PositionListUserVO>> authListPositionTreeUser() {
                return null;
            }

            @Override
            public List<OrganizeAndPositionListVO> authOrganizeWithPositions(OrganizeWithPositionsDTO dto) {
                return List.of();
            }

            @Override
            public ActionResult<List<UserBoundVO>> authGetAllUserInfoBatch() {
                return null;
            }

            @Override
            public ActionResult<List<String>> authGetPermissionScopeUserIds() {
                return null;
            }

            @Override
            public ActionResult<List<OrganizeManagerNodeVO>> listOrganizeTreeUsers() {
                return null;
            }

            @Override
            public ActionResult<List<OrganizeGeneralDetailVO>> authOrganizesByUserBound(List<OrganizeCategoryEnums> organizeCategoryEnums) {
                return null;
            }

            @Override
            public List<OrganizeManagerFilterNodeVO> listOrganizeTreeFilterNode(List<OrganizeCategoryEnums> organizeCategoryEnums, List<UserWorkStatusEnums> workStatusEnums, Boolean withEmployee, Boolean filterBindOtherStore, Boolean filterBindPayStore) {
                return List.of();
            }

            @Override
            public ActionResult<List<FtbRoleListDropDownVO>> roleListDropDown(String userId, String tenantId) {
                return null;
            }

            @Override
            public InnerPowerUserVO queryUserScopeOfPermissionForModuleCode() {
                return null;
            }

            @Override
            public void remoteClient(FunctionMenuRemoteDTO dto) {

            }

            @Override
            public InnerPowerPositionVO getCurrLoginUserHasPermissionPositionId(String permissionModule) {
                return null;
            }

            @Override
            public void clearRoleByPostId(List<String> postIds) {

            }

            @Override
            public Map<String, List<String>> batchAuthOrganizesForUserIdsAndTenantId(List<String> userIds, Integer status, String moduleId, String tenantId) {
                return Map.of();
            }
            @Override
            public Map<String, List<String>> batchAuthOrganizesAllForUserIdsAndTenantId(List<String> userIds, Integer status, String moduleId, String tenantId) {
                return Map.of();
            }

            @Override
            public Map<String, List<String>> batchAuthOrganizesForUserIds(List<String> userIds, Integer status) {
                return null;
            }


            @Override
            public ActionResult<PageListVO<FtbPermissionRoleInfoVO>> permissionList(CultivatePage cultivatePage, FtbPermissionRoleInfoDTO roleInfoDTO) {
                return null;
            }

            @Override
            public ActionResult<List<String>> permissionUser(String userId, String permissionModule, String category) {
                return null;
            }

            @Override
            public ActionResult<FtbPermissionRoleIdentificationVO> permissionIdentificationCollection() {
                return null;
            }

            @Override
            public List<String> queryButtonPermission(FuntionMenuDTO funtion) {
                return null;
            }

            @Override
            public Map<String, List<String>> getUserPermissionUserCollection(List<String> userIds) {
                return Collections.emptyMap();
            }

            @Override
            public ActionResult<List<MenuTreeVO>> obtainMenusOnToken(String type) {
                log.warn("FtbAuthorityApi fallback: obtainMenusOnToken type={}", type);
                return ActionResult.success(Collections.emptyList());
            }

            @Override
            public TargetAuthIdsVO getUserAuth() {
                return null;
            }
        };
    }
}
