#include <string>

#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/log/log.h"
#include "install/installer.h"

ABSL_FLAG(std::string, inventory_dir, "/run/install/inventory",
          "Directory where firmware inventory is stored.");
ABSL_FLAG(std::string, install_lock_file, "/run/install/install_ongoing",
          "Lock file to indicate an installation is in progress.");
ABSL_FLAG(std::string, bundle_tar_file,
          "/mnt/luks-mmcblk0_fs/firmware_bundle.tar.gz",
          "File path where firmware bundle gets stored by Redfish update. The "
          "untarred files will be stored in the same directory under "
          "`firmware_bundle` folder.");
ABSL_FLAG(std::string, activation_check_dir, "/var/google/firmware_bundle/",
          "Directory where activation check scripts are persisted.");
ABSL_FLAG(std::string, mode, "post_install",
          "The mode of the installer. Can be `post_install` or "
          "`activation_check`");

namespace {

using ::bloom_install::ActivationMain;
using ::bloom_install::PostInstallMain;

}  // namespace

int main(int argc, char* argv[]) {
  absl::ParseCommandLine(argc, argv);

  std::string mode = absl::GetFlag(FLAGS_mode);
  if (mode != "post_install" && mode != "activation_check") {
    LOG(ERROR) << "Invalid mode: " << mode;
    return 1;
  }

  if (mode == "activation_check") {
    return ActivationMain(absl::GetFlag(FLAGS_activation_check_dir));
  }

  return PostInstallMain(absl::GetFlag(FLAGS_inventory_dir),
                         absl::GetFlag(FLAGS_install_lock_file),
                         absl::GetFlag(FLAGS_bundle_tar_file),
                         absl::GetFlag(FLAGS_activation_check_dir));
}
