/*
   This file is part of TALER
   Copyright (C) 2022, 2026 Taler Systems SA

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

   TALER 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 General Public License for more details.

   You should have received a copy of the GNU General Public License along with
   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
 */
/**
 * @file get_reserve_close_request_info.h
 * @brief implementation of the select_reserve_close_request_info function
 * @author Christian Grothoff
 */
#ifndef EXCHANGE_DATABASE_GET_RESERVE_CLOSE_REQUEST_INFO_H
#define EXCHANGE_DATABASE_GET_RESERVE_CLOSE_REQUEST_INFO_H

#include "taler/taler_util.h"
#include "taler/taler_json_lib.h"
#include "exchangedb_lib.h"


/**
 * Select information about reserve close requests.
 *
 * @param pg the database context
 * @param reserve_pub which reserve is this about?
 * @param rowid row ID of the close request
 * @param[out] reserve_sig reserve signature affirming
 * @param[out] request_timestamp when was the request made
 * @param[out] close_balance reserve balance at close time
 * @param[out] close_fee closing fee to be charged
 * @param[out] payto_uri set to URL of account that
 *             should receive the money;
 *             could be set to NULL for origin
 * @return transaction status code, 0 if reserve unknown
 */
enum GNUNET_DB_QueryStatus
TALER_EXCHANGEDB_get_reserve_close_request_info (
  struct TALER_EXCHANGEDB_PostgresContext *pg,
  const struct TALER_ReservePublicKeyP *reserve_pub,
  uint64_t rowid,
  struct TALER_ReserveSignatureP *reserve_sig,
  struct GNUNET_TIME_Timestamp *request_timestamp,
  struct TALER_Amount *close_balance,
  struct TALER_Amount *close_fee,
  struct TALER_FullPayto *payto_uri);

#endif
