import AppKit
import AlignerCore

@MainActor
final class OverlayWindowController {
    private let host: any OverlayHostProtocol
    private(set) var isVisible = false

    init(host: any OverlayHostProtocol) {
        self.host = host
    }

    var currentLevel: CGWindowLevel {
        host.currentLevel
    }

    func show(context: OverlayContext) {
        host.show(context: context)
        isVisible = true
    }

    func hide(reason: DismissReason) {
        host.hide(reason: reason)
        isVisible = false
    }

    func promoteForTextInput(allowAppActivation: Bool) {
        host.promoteForTextInput(allowAppActivation: allowAppActivation)
    }

    func attachChild(_ window: NSWindow) {
        host.attachChild(window)
    }

    func detachChild(_ window: NSWindow) {
        host.detachChild(window)
    }
}
