// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Boolberry developers
// Copyright (c) 2017-2025 Lethean (https://lt.hn)
//
// Licensed under the European Union Public Licence (EUPL) version 1.2.
// You may obtain a copy of the licence at:
//
//     https://joinup.ec.europa.eu/software/page/eupl/licence-eupl
//
// The EUPL is a copyleft licence that is compatible with the MIT/X11
// licence used by the original projects; the MIT terms are therefore
// considered “grandfathered” under the EUPL for this code.
//
// SPDX‑License‑Identifier: EUPL-1.2
//
#pragma once

#include <string>
#include <cstdint>
//#include "../common/error_codes.h"

namespace plain_wallet
{
  typedef int64_t hwallet;
  std::string init(const std::string& address, const std::string& working_dir, int log_level);
  std::string init(const std::string& ip, const std::string& port, const std::string& working_dir, int log_level);
  std::string reset();
  std::string set_log_level(int log_level);
  std::string get_version();
  std::string get_wallet_files();
  std::string get_export_private_info(const std::string& target_dir);
  std::string delete_wallet(const std::string& file_name);
  std::string get_address_info(const std::string& addr);

  std::string get_appconfig(const std::string& encryption_key);
  std::string set_appconfig(const std::string& conf_str, const std::string& encryption_key);
  std::string generate_random_key(uint64_t lenght);
  std::string get_logs_buffer();
  std::string truncate_log();
  std::string get_connectivity_status();

  std::string open(const std::string& path, const std::string& password);
  std::string restore(const std::string& seed, const std::string& path, const std::string& password, const std::string& seed_password);
  std::string generate(const std::string& path, const std::string& password);
  std::string get_opened_wallets();  


  std::string get_wallet_status(hwallet h);
  std::string close_wallet(hwallet h);
  std::string invoke(hwallet h, const std::string& params);
  
  //async api
  std::string async_call(const std::string& method_name, uint64_t instance_id, const std::string& params);
  std::string try_pull_result(uint64_t);
  std::string sync_call(const std::string& method_name, uint64_t instance_id, const std::string& params);

  //cake wallet api extension
  bool is_wallet_exist(const std::string& path);
  std::string get_wallet_info(hwallet h);
  std::string reset_wallet_password(hwallet h, const std::string& password);
  uint64_t get_current_tx_fee(uint64_t priority); // 0 (default), 1 (unimportant), 2 (normal), 3 (elevated), 4 (priority)
  
  //callback-mode for async calls
  typedef void (*callback_type)(uint64_t job_id, const std::string& job_response);
  void set_callback(callback_type callback);
}


