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

import SwiftUI
import SwiftData

@main
struct WorkoutsWatchApp: App {
    @State private var services = WatchAppServices()
    @WKApplicationDelegateAdaptor(WatchAppDelegate.self) private var appDelegate

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

    private var root: some View {
        ContentView()
            .environment(services.bridge)
            .environment(appDelegate.sessionManager)
            .modelContainer(services.container)
            .task { services.bootstrap(sessionManager: appDelegate.sessionManager) }
    }
}
