local WindowManager = require("window-management/helpers")

hs.hotkey.bind({ "cmd", "alt" }, "h", function()
  WindowManager.startMoving("shrink-right")
end, function()
  WindowManager.stopMoving()
end)

hs.hotkey.bind({ "cmd", "alt" }, "l", function()
  WindowManager.startMoving("shrink-left")
end, function()
  WindowManager.stopMoving()
end)

hs.hotkey.bind({ "cmd", "alt" }, "k", function()
  WindowManager.startMoving("shrink-up")
end, function()
  WindowManager.stopMoving()
end)

hs.hotkey.bind({ "cmd", "alt" }, "j", function()
  WindowManager.startMoving("shrink-down")
end, function()
  WindowManager.stopMoving()
end)

hs.hotkey.bind({ "cmd", "alt", "shift" }, "h", function()
  WindowManager.startMoving("grow-left")
end, function()
  WindowManager.stopMoving()
end)

hs.hotkey.bind({ "cmd", "alt", "shift" }, "l", function()
  WindowManager.startMoving("grow-right")
end, function()
  WindowManager.stopMoving()
end)

hs.hotkey.bind({ "cmd", "alt", "shift" }, "k", function()
  WindowManager.startMoving("grow-up")
end, function()
  WindowManager.stopMoving()
end)

hs.hotkey.bind({ "cmd", "alt", "shift" }, "j", function()
  WindowManager.startMoving("grow-down")
end, function()
  WindowManager.stopMoving()
end)

-- Fullscreen
hs.hotkey.bind({ "cmd", "alt" }, "f", function()
  local window = hs.window.focusedWindow()
  window:maximize(true)
end)

-- Expand window on all sides (hold to continuously expand)
hs.hotkey.bind({ "cmd", "alt" }, "=", function()
  WindowManager.startMoving("expand")
end, function()
  WindowManager.stopMoving()
end)

-- Shrink window on all sides (hold to continuously shrink)
hs.hotkey.bind({ "cmd", "alt" }, "-", function()
  WindowManager.startMoving("shrink")
end, function()
  WindowManager.stopMoving()
end)
