cask "ltspice" do
  version "26.0.2"
  sha256 :no_check

  url "https://ltspice.analog.com/software/LTspice.pkg"
  name "LTspice"
  desc "SPICE simulation software, schematic capture and waveform viewer"
  homepage "https://www.analog.com/en/resources/design-tools-and-calculators/ltspice-simulator.html"

  livecheck do
    url :homepage, user_agent: :browser
    regex(/for\s+MacOS.*?Version\s+v?(\d+(?:\.\d+)+)/im)
  end

  depends_on :macos

  pkg "LTspice.pkg"

  uninstall pkgutil: [
    "com.analog.LTspice",
    "com.analog.LTspice.App",
  ]

  zap trash: [
        "~/Documents/LTspice/examples",
        "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.analog.ltspice.app.sfl*",
        "~/Library/Application Support/LTspice",
        "~/Library/Preferences/com.analog.LTspice.App.plist",
        "~/Library/Saved Application State/com.analog.LTspice.App.savedState",
      ],
      rmdir: "~/Documents/LTspice"
end
