/*
  This file is part of Anastasis
  Copyright (C) 2019-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_database_lib.h
 * @brief Anastasis database library interface
 * @author Dominik Meister
 * @author Dennis Neufeld
 * @author Christian Grothoff
 */
#ifndef ANASTASIS_DB_LIB_H
#define ANASTASIS_DB_LIB_H

#include "anastasis_service.h"
#include <gnunet/gnunet_db_lib.h>
#include "anastasis/anastasis-database/common.h"
#include "anastasis/anastasis-database/preflight.h"
#include "anastasis/anastasis-database/transaction.h"
#include "anastasis/anastasis-database/event.h"
#include "anastasis/anastasis-database/create_tables.h"
#include "anastasis/anastasis-database/drop_tables.h"
#include "anastasis/anastasis-database/do_gc.h"
#include "anastasis/anastasis-database/do_insert_recovery_document.h"
#include "anastasis/anastasis-database/iterate_recovery_meta_data.h"
#include "anastasis/anastasis-database/get_recovery_document.h"
#include "anastasis/anastasis-database/get_latest_recovery_document.h"
#include "anastasis/anastasis-database/insert_truth.h"
#include "anastasis/anastasis-database/get_truth.h"
#include "anastasis/anastasis-database/get_truth_key_share.h"
#include "anastasis/anastasis-database/get_account.h"
#include "anastasis/anastasis-database/get_recdoc_payment.h"
#include "anastasis/anastasis-database/get_challenge_payment.h"
#include "anastasis/anastasis-database/do_update_account_lifetime.h"
#include "anastasis/anastasis-database/do_insert_recdoc_payment.h"
#include "anastasis/anastasis-database/insert_truth_payment.h"
#include "anastasis/anastasis-database/get_truth_payment.h"
#include "anastasis/anastasis-database/do_verify_challenge_code.h"
#include "anastasis/anastasis-database/update_to_challenge_code_satisfied.h"
#include "anastasis/anastasis-database/update_totp_counter.h"
#include "anastasis/anastasis-database/update_auth_iban_in_currency.h"
#include "anastasis/anastasis-database/get_exists_challenge_code_satisfied.h"
#include "anastasis/anastasis-database/insert_challenge_code.h"
#include "anastasis/anastasis-database/update_to_challenge_code_sent.h"
#include "anastasis/anastasis-database/insert_challenge_payment.h"
#include "anastasis/anastasis-database/update_to_challenge_payment_refunded.h"
#include "anastasis/anastasis-database/get_pending_challenge_payment.h"
#include "anastasis/anastasis-database/update_to_challenge_payment_paid.h"
#include "anastasis/anastasis-database/insert_auth_iban_in.h"
#include "anastasis/anastasis-database/iterate_auth_iban_transfers.h"
#include "anastasis/anastasis-database/get_last_auth_iban_in_row.h"


/**
 * Initialize the Anastasis database subsystem.
 *
 * @param cfg configuration to use
 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
 */
enum GNUNET_GenericReturnValue
ANASTASIS_DB_init (
  const struct GNUNET_CONFIGURATION_Handle *cfg);


/**
 * Initialize the Anastasis database subsystem for administration.
 * Disables the check that the database schema is current.
 *
 * @param cfg configuration to use
 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
 */
enum GNUNET_GenericReturnValue
ANASTASIS_DB_init_admin (
  const struct GNUNET_CONFIGURATION_Handle *cfg);


/**
 * Shutdown the Anastasis database subsystem.
 */
void
ANASTASIS_DB_fini (void);


#endif  /* ANASTASIS_DB_LIB_H */

/* end of anastasis_database_lib.h */
