//
//  AppCoordinator.swift
//  1Weather
//
//  Created by Dmitry Stepanets on 08.02.2021.
//

import UIKit

class AppCoordinator: Coordinator {
    //Private
    private let tabBarController = AppTabBarController()
    
    //Public
    var parentCoordinator: Coordinator?
    var childCoordinators = [Coordinator]()
    
    init(window:UIWindow) {
        window.rootViewController = tabBarController
        window.makeKeyAndVisible()
    }
    
    func start() {
        let todayCoordinator = TodayCoordinator(tabBarController: tabBarController)
        todayCoordinator.start()
        childCoordinators.append(todayCoordinator)
        
        let forecastCoordinator = ForecastCoordinator(tabBarController: tabBarController)
        forecastCoordinator.start()
        childCoordinators.append(forecastCoordinator)
        
        let radarCoordinator = ForecastCoordinator(tabBarController: tabBarController)
        radarCoordinator.start()
        childCoordinators.append(radarCoordinator)
        
        let menuCoordinator = MenuCoordinator(tabBarController: tabBarController)
        menuCoordinator.start()
        childCoordinators.append(menuCoordinator)
        
        tabBarController.setupTabBar()
    }
    
    func viewControllerDidEnd(controller: UIViewController) {
        //
    }
}
