import Foundation

struct PendingNavigation: Equatable {
    let serverURL: String
    let username: String
    let targetTab: Int
}

@Observable
@MainActor
final class NavigationState {
    static let shared = NavigationState()

    var pendingNavigation: PendingNavigation?
    var notificationsRefreshTrigger = 0

    private init() {}

    func navigateToNotifications(serverURL: String, username: String) {
        pendingNavigation = PendingNavigation(serverURL: serverURL, username: username, targetTab: 3)
        notificationsRefreshTrigger += 1
    }

    func consume() {
        pendingNavigation = nil
    }
}
