import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { firstValueFrom } from 'rxjs';
import { TrashService } from '@services/entity-services/trash.service';

@Injectable({ providedIn: 'root' })
export class TrashGuard implements CanActivate {
    constructor(private readonly _trashService: TrashService) {}

    async canActivate(): Promise<boolean> {
        await firstValueFrom(this._trashService.loadAll());
        return true;
    }
}
