package com.inspect.common.security.auth;

import com.inspect.common.security.annotation.RequiresPermissions;
import com.inspect.common.security.annotation.RequiresRoles;
import com.inspect.system.base.model.LoginUser;

public class AuthUtil {
    public static AuthLogic authLogic = new AuthLogic();

    public static void logout() {
        authLogic.logout();
    }

    public static void logoutByToken(String token) {
        authLogic.logoutByToken(token);
    }

    public static void checkLogin() {
        authLogic.checkLogin();
    }

    public static LoginUser getLoginUser(String token) {
        return authLogic.getLoginUser(token);
    }

    public static void verifyLoginUserExpire(LoginUser loginUser) {
        authLogic.verifyLoginUserExpire(loginUser);
    }

    public static boolean hasRole(String role) {
        return authLogic.hasRole(role);
    }

    public static void checkRole(String role) {
        authLogic.checkRole(role);
    }

    public static void checkRole(RequiresRoles requiresRoles) {
        authLogic.checkRole(requiresRoles);
    }

    public static void checkRoleAnd(String... roles) {
        authLogic.checkRoleAnd(roles);
    }

    public static void checkRoleOr(String... roles) {
        authLogic.checkRoleOr(roles);
    }

    public static boolean hasPermission(String permission) {
        return authLogic.hasPermission(permission);
    }

    public static void checkPermission(String permission) {
        authLogic.checkPermission(permission);
    }

    public static void checkPermission(RequiresPermissions requiresPermissions) {
        authLogic.checkPermission(requiresPermissions);
    }

    public static void checkPermissionAnd(String... permissions) {
        authLogic.checkPermissionAnd(permissions);
    }

    public static void checkPermissionOr(String... permissions) {
        authLogic.checkPermiOr(permissions);
    }
}
