/*
  This file is part of Anastasis
  Copyright (C) 2020-2022 Anastasis SARL

  Anastasis is free software; you can redistribute it and/or modify it under the
  terms of the GNU Affero General Public License as published by the Free Software
  Foundation; either version 3, or (at your option) any later version.

  Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License along with
  Anastasis; see the file COPYING.GPL.  If not, see <http://www.gnu.org/licenses/>
*/
/**
 * @file include/anastasis/anastasis-database/get_account.h
 * @brief Anastasis database: get account
 * @author Christian Grothoff
 */
#ifndef ANASTASIS_DATABASE_GET_ACCOUNT_H
#define ANASTASIS_DATABASE_GET_ACCOUNT_H

#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_db_lib.h>
#include "anastasis_service.h"
#include "anastasis/anastasis-database/common.h"

/**
 * Check if an account exists, and if so, return the
 * current @a recovery_document_hash.
 *
 * @param account_pub account identifier
 * @param[out] paid_until until when is the account paid up?
 * @param[out] recovery_data_hash set to hash of @a recovery document
 * @param[out] version set to the recovery policy version
 * @return transaction status
 */
enum ANASTASIS_DB_AccountStatus
ANASTASIS_DB_get_account (
  const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
  struct GNUNET_TIME_Timestamp *paid_until,
  struct GNUNET_HashCode *recovery_data_hash,
  uint32_t *version);

#endif
