package com.cico.nest.lcdp.boot.core.system.api.permission;

import com.cico.nest.lcdp.boot.api.system.permission.PermissionApi;
import com.cico.nest.lcdp.boot.core.system.service.permission.PermissionService;
import com.cico.nest.lcdp.boot.core.system.service.user.AdminUserService;
import com.cico.nest.lcdp.boot.security.core.LoginUser;
import com.cico.nest.lcdp.boot.security.core.util.SecurityFrameworkUtils;
import com.cico.nest.lcdp.framework.api.permission.dto.LcdpDataPermissionDTO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * 权限 API 实现类
 *
 * @author zws
 */
@Service
public class PermissionApiImpl implements com.cico.nest.lcdp.framework.api.permission.LcdpPermissionApi, PermissionApi {

    @Resource
    private PermissionService permissionService;

    @Override
    public Set<Long> getUserRoleIdListByRoleIds(Collection<Long> roleIds) {
        return permissionService.getUserRoleIdListByRoleId(roleIds);
    }

    @Override
    public boolean hasAnyPermissions(Long userId, String... permissions) {
        return permissionService.hasAnyPermissions(userId, permissions);
    }

    @Override
    public boolean hasAnyRoles(Long userId, String... roles) {
        return permissionService.hasAnyRoles(userId, roles);
    }

    @Override
    public LcdpDataPermissionDTO getDeptDataPermission(String userId) {
        return permissionService.getDeptDataPermission(Long.valueOf(userId));
    }

}
