import Foundation
import Observation
import SwiftData

/// Composition root for the watch app. Owns the local SwiftData cache and the
/// WatchConnectivity bridge. The watch has no iCloud access; all data arrives from
/// the phone via the bridge.
@Observable
@MainActor
final class WatchAppServices {
    let container: ModelContainer
    let bridge: WatchConnectivityBridge

    init() {
        let container = WorkoutsModelContainer.make()
        self.container = container
        self.bridge = WatchConnectivityBridge(container: container)
        #if DEBUG
        if ScreenshotSeed.isActive { ScreenshotSeed.populate(container.mainContext) }
        #endif
    }

    func activate() {
        bridge.activate()
    }
}
