# typed: false
# frozen_string_literal: true

class Kopia < Formula
  desc "Fast and secure open source backup."
  homepage "https://kopia.io"
  version "VERSION"
  bottle :unneeded

  if OS.mac? && Hardware::CPU.intel?
    url "https://github.com/SOURCE_REPO/releases/download/vVERSION/kopia-VERSION-macOS-x64.tar.gz"
    sha256 "HASH_MAC_AMD64"
  end
  if OS.mac? && Hardware::CPU.arm?
    url "https://github.com/SOURCE_REPO/releases/download/vVERSION/kopia-VERSION-macOS-arm64.tar.gz"
    sha256 "HASH_MAC_ARM64"
  end
  if OS.linux? && Hardware::CPU.intel?
    url "https://github.com/SOURCE_REPO/releases/download/vVERSION/kopia-VERSION-linux-x64.tar.gz"
    sha256 "HASH_LINUX_AMD64"
  end
  if OS.linux? && Hardware::CPU.arm? && !Hardware::CPU.is_64_bit?
    url "https://github.com/SOURCE_REPO/releases/download/vVERSION/kopia-VERSION-linux-arm.tar.gz"
    sha256 "HASH_LINUX_ARM"
  end
  if OS.linux? && Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
    url "https://github.com/SOURCE_REPO/releases/download/vVERSION/kopia-VERSION-linux-arm64.tar.gz"
    sha256 "HASH_LINUX_ARM64"
  end

  def install
    bin.install "kopia"
  end
end
