import { Store } from "@ngrx/store";
import { AppState } from "src/app/store/app.reducers";
import { HttpClient } from "@angular/common/http";
import { Router } from "@angular/router";
import { RoleUtil } from "../role.util";
import { AbstractRoleGuard } from "./abstract-role.guard";
import { User } from "../model/user.model";
import { Injectable } from "@angular/core";

@Injectable()
export class UserRoleGuard extends AbstractRoleGuard{
    
    constructor(store: Store<AppState>, http: HttpClient, router: Router, private roleUtil: RoleUtil) {
        super(store, http, router);
    }

    hasRights(roleNameOrUser: String | User): boolean{
        return this.roleUtil.hasUserRights(roleNameOrUser);
    }

}