class WebdropBridge < Formula
  desc "Intelligent drag-and-drop file bridge for web to desktop applications"
  homepage "https://git.him-tools.de/HIM-public/webdrop-bridge"
  version "0.8.0"
  
  # ARM64 (Apple Silicon)
  on_arm do
    url "https://git.him-tools.de/HIM-public/webdrop-bridge/releases/download/v0.8.0/WebDropBridge_Setup.dmg"
    sha256 "" # Update with actual checksum
  end
  
  # Intel x86_64
  on_intel do
    url "https://git.him-tools.de/HIM-public/webdrop-bridge/releases/download/v0.8.0/WebDropBridge_Setup.dmg"
    sha256 "" # Update with actual checksum (may be same as ARM64 if universal binary)
  end
  
  license "MIT"
  
  livecheck do
    url "https://git.him-tools.de/api/v1/repos/HIM-public/webdrop-bridge/releases/latest"
    strategy :json do |json|
      json["tag_name"]&.strip&.sub(/^v/, "")
    end
  end
  
  app "WebDropBridge.app"
  
  post_install do
    # Create user defaults directory if needed
    system "mkdir", "-p", "#{Dir.home}/.webdrop-bridge"
  end
  
  def caveats
    <<~EOS
      WebDropBridge has been installed.
      
      Configuration files are stored in: ~/.webdrop-bridge/
      Logs are written to: ~/.webdrop-bridge/logs/
      
      To start the application:
      - Open Applications > WebDropBridge
      - Or run: open /Applications/WebDropBridge.app
      
      For documentation: https://git.him-tools.de/HIM-public/webdrop-bridge
    EOS
  end
end
