/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <iostream>
#include <optional>
#include <string>
#include <vector>

#include "cuttlefish/result/result.h"
#include "cuttlefish/common/libs/utils/tee_logging.h"

namespace cuttlefish {

enum class SnapshotCmd : int {
  kUnknown = 0,
  kSuspend = 1,
  kResume = 2,
  kSnapshotTake = 3,
};

std::ostream& operator<<(std::ostream& out, const SnapshotCmd& cmd);

struct Parsed {
  SnapshotCmd cmd;
  std::vector<int> instance_nums;
  int wait_for_launcher;
  std::string snapshot_path;
  bool cleanup_snapshot_path;
  // Delete snapshot_path if already present.
  bool force = false;
  // Suspend/resume before/after taking the snapshot.
  //
  // Ideally we'd detect the suspended state of CF and do this automatically by
  // default.
  bool auto_suspend = false;
  std::optional<LogSeverity> verbosity_level;
};
Result<Parsed> Parse(int argc, char** argv);
Result<Parsed> Parse(std::vector<std::string>& args);

}  // namespace cuttlefish
