//
//  WorkoutsApp.swift
//  Workouts
//
//  Copyright 2025 Rouslan Zenetl. All Rights Reserved.
//

import SwiftUI
import SwiftData

@main
struct WorkoutsApp: App {
    @State private var services = AppServices()

    var body: some Scene {
        WindowGroup {
            #if DEBUG
            if ScreenshotSeed.isActive {
                ScreenshotRootView(services: services)
            } else {
                root
            }
            #else
            root
            #endif
        }
    }

    private var root: some View {
        RootGateView()
            .environment(services)
            .environment(services.syncEngine)
            .modelContainer(services.container)
            .task { await services.bootstrap() }
    }
}
