//
//  MainVCViewController.swift
//  Em-call
//
//  Created by Alex Sh on 12.04.2022.
//

import UIKit
//import SOTabBarController

class MainVCViewController:  SOTabBarController {
    /*func tabBarController(_ tabBarController: SOTabBarController, didSelect viewController: UIViewController) {
        print(viewController.tabBarItem.title ?? "")
    }
    func tabBarController(_ tabBarController: UITabBarController,_: SOTabBarController, didSelect viewController: UIViewController) {
        print(viewController.tabBarItem.title ?? "")
    }*/
    
    var firstVC:UIViewController = UIViewController()
    var secondVC:UIViewController = UIViewController()
    var thrVC :UIViewController = UIViewController()
    var foVC:UIViewController = UIViewController()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.delegate = self
         firstVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Logo")
         secondVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "BookingVK")
         thrVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Chat")
         foVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ProfileVC")
       
        firstVC.tabBarItem = UITabBarItem(title: "Home", image: UIImage(named: "Home_white1"), selectedImage: UIImage(named: "Home_black"))
        secondVC.tabBarItem = UITabBarItem(title: "BookingVK", image: UIImage(named: "Bookings_white"), selectedImage: UIImage(named: "Bookings_black"))
       // thrVC.tabBarItem = UITabBarItem(title: "Chat", image: UIImage(named: "firstImage"), selectedImage: UIImage(named: "firstSelectedImage"))
        thrVC.tabBarItem = UITabBarItem(title: "Chat", image: UIImage(named: "Chat_white"), selectedImage: UIImage(named: "Chat_black"))
        foVC.tabBarItem = UITabBarItem(title: "Profile", image: UIImage(named: "profile_white2"), selectedImage: UIImage(named: "Profile_black2"))

        viewControllers = [firstVC, secondVC,thrVC,foVC]
    }
     func soTabBar(_ tabBar: SOTabBar, didSelectTabAt index: Int) {
        print("did Tapped On \(index)")
    }
    override func loadView() {
        super.loadView()
        // SOTabBarSetting.propertyToCustomize = value
        SOTabBarSetting.tabBarBackground = UIColor.black
        SOTabBarSetting.tabBarTintColor = UIColor.white
        //SOTabBarSetting.tabBarTintColor = UIColor.clear
        //SOTabBarSetting.tabBarShadowColor = UIColor.lightGray.cgColor
        SOTabBarSetting.tabBarShadowColor = UIColor.lightGray.cgColor
        SOTabBarSetting.tabBarCircleSize = CGSize(width: 60, height: 60)
        SOTabBarSetting.tabBarAnimationDurationTime = 0.1
        SOTabBarSetting.tabBarHeight = 67
        //SOTabBarSetting.tabBarCircleSize = CGSize(width: 40, height: 40)
    }
    override func viewWillAppear(_ animated: Bool) {
       // let firstVC:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Logo")
       // viewControllers[0].show(firstVC, sender: nil)
    }
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}

extension MainVCViewController: SOTabBarControllerDelegate {
    func tabBarController(_ tabBarController: SOTabBarController, didSelect viewController: UIViewController) {
        print(viewController.tabBarItem.title ?? "")
    }
}
