import Cocoa
import FlutterMacOS

class MainFlutterWindow: NSWindow {
  override func awakeFromNib() {
    let flutterViewController = FlutterViewController()
    self.contentViewController = flutterViewController

    // Set initial window size (matching Windows: 1280x720)
    let windowWidth: CGFloat = 1280
    let windowHeight: CGFloat = 720
    if let screen = NSScreen.main {
      let screenFrame = screen.visibleFrame
      let x = screenFrame.origin.x + (screenFrame.width - windowWidth) / 2
      let y = screenFrame.origin.y + (screenFrame.height - windowHeight) / 2
      self.setFrame(NSRect(x: x, y: y, width: windowWidth, height: windowHeight), display: true)
    }
    self.minSize = NSSize(width: 900, height: 600)

    RegisterGeneratedPlugins(registry: flutterViewController)

    super.awakeFromNib()
  }
}
