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

import { AdminDataService } from './admin-data.service'
import { BasketNameOnly, SurveyMeta, AdminService } from '../openapi'


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

    resolve(
        route: ActivatedRouteSnapshot,
        state: RouterStateSnapshot,
        ): Observable<[BasketNameOnly[], SurveyMeta]> {
        return forkJoin([
            this.adminService.getBasketsApiAdminBasketGet(),
            this.dataService.getSurveyMeta(),
        ])
    }
}
