import { Injectable } from '@angular/core'
import { Router, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router'
import { Observable, forkJoin } from 'rxjs'
import { map } from 'rxjs/operators'

import { AdminDataService } from './admin-data.service'
import { SurveyMeta } from './admin-data.service'
import { AdminBasketDataService, AdminBasket } from './admin-basket/data.service'


@Injectable()
export class AdminResolver  {
    constructor(
        private router: Router,
        private dataService: AdminDataService,
        private basketDataService: AdminBasketDataService,
    ) {}

    resolve(
        route: ActivatedRouteSnapshot,
        state: RouterStateSnapshot,
        ): Observable<[AdminBasket[], SurveyMeta/*, object[]*/]> {
        return forkJoin(
            this.basketDataService.getBaskets(),
            this.dataService.getSurveyMeta(),
            //this.dataService.getModelsMenuBar(),
        )
    }
}
