import Foundation
import SkipFuse
import SwiftUI
import PokerUI

/// The Android app. Same `RootView` as the Mac and the iPhone, which lays itself out for the space
/// it gets — this file is the whole of the platform-specific Swift, and `Android/` holds the
/// equally thin Kotlin that Android needs to start an app at all.
///
/// The `SKIP @bridge` marks are what let that Kotlin reach this Swift. Nothing else in the app is
/// bridged: every screen is compiled Swift talking to Skip's SwiftUI, which draws it with Compose.
/* SKIP @bridge */public struct PokerTutorAndroidRootView : View {
    // Internal rather than private: Skip's bridge has to be able to see it.
    @State var app = AppState()

    /* SKIP @bridge */public init() {
    }

    public var body: some View {
        RootView()
            .environment(app)
            .preferredColorScheme(.dark)
            // The free allowance and the store. Only the shipping apps switch this on: the suite
            // and the command line play far more hands than anybody pays for.
            .task { app.startCharging() }
    }
}

/// What Android tells the app about its own life. Nothing listens yet; the table pauses itself
/// when the screen changes and the history is written a hand at a time, so there is nothing to
/// save in a hurry when the app goes to the background.
/* SKIP @bridge */public final class PokerTutorAndroidAppDelegate : Sendable {
    /* SKIP @bridge */public static let shared = PokerTutorAndroidAppDelegate()

    private init() {
    }

    /* SKIP @bridge */public func onInit() {}
    /* SKIP @bridge */public func onLaunch() {}
    /* SKIP @bridge */public func onResume() {}
    /* SKIP @bridge */public func onPause() {}
    /* SKIP @bridge */public func onStop() {}
    /* SKIP @bridge */public func onDestroy() {}
    /* SKIP @bridge */public func onLowMemory() {}
}
