//
//  volnahubApp.swift
//  Shared
//
//  Created by cheykrym on 09/06/2025.
//

import SwiftUI

//@AppStorage("isLoggedIn") var isLoggedIn: Bool = false
//@AppStorage("isDarkMode") private var isDarkMode: Bool = false
//@AppStorage("currentUser") var currentUser: String = ""

@main
struct volnahubApp: App {
    @AppStorage("isDarkMode") private var isDarkMode: Bool = true
    @StateObject private var viewModel = LoginViewModel()
    
    var body: some Scene {
        WindowGroup {
            ZStack {
                Color(isDarkMode ? .black : .white) // ✅ Фон в зависимости от темы

                if viewModel.isLoading{
                    SplashScreenView()
                }else{
                    if viewModel.isLoggedIn {
                        MainView(viewModel: viewModel)
                    } else {
                        LoginView(viewModel: viewModel)
                    }
                }
            }
            .preferredColorScheme(isDarkMode ? .dark : .light)
        }
    }
}
