var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Injectable } from '@angular/core';
import { Router, CanActivate, ActivatedRouteSnapshot } from '@angular/router';
import { AuthService } from '../services/auth.service';
import * as i0 from "@angular/core";
import * as i1 from "../../public-api";
import * as i2 from "@angular/router";
var AbleBuyerGuardService = /** @class */ (function () {
    function AbleBuyerGuardService(auth, router) {
        this.auth = auth;
        this.router = router;
    }
    AbleBuyerGuardService.prototype.canActivate = function (routeSnapshot) {
        var redirectTo = routeSnapshot.data.redirectSellerTo || '/';
        if (!this.auth.isAbleToBuy())
            this.router.navigateByUrl(redirectTo);
        return this.auth.isAbleToBuy();
    };
    AbleBuyerGuardService.ctorParameters = function () { return [
        { type: AuthService },
        { type: Router }
    ]; };
    AbleBuyerGuardService.ɵprov = i0.ɵɵdefineInjectable({ factory: function AbleBuyerGuardService_Factory() { return new i1.AbleBuyerGuardService(i0.ɵɵinject(i1.AuthService), i0.ɵɵinject(i2.Router)); }, token: i1.AbleBuyerGuardService, providedIn: "root" });
    AbleBuyerGuardService = __decorate([
        Injectable({
            providedIn: 'root'
        })
    ], AbleBuyerGuardService);
    return AbleBuyerGuardService;
}());
export { AbleBuyerGuardService };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWJsZS1idXllci1ndWFyZC5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctZWFzeWNvbW1lcmNlLyIsInNvdXJjZXMiOlsibGliL2d1YXJkcy9hYmxlLWJ1eWVyLWd1YXJkLnNlcnZpY2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