/*
   This file is part of TALER
   Copyright (C) 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 src/include/auditor-database/insert_aml_hold.h
 * @brief implementation of the insert_aml_hold function
 * @author Christian Grothoff
 */
#ifndef AUDITOR_DATABASE_INSERT_AML_HOLD_H
#define AUDITOR_DATABASE_INSERT_AML_HOLD_H

#include "taler/taler_util.h"
#include "auditordb_lib.h"


/**
 * Record that the exchange aggregated deposits into @a wtid but has not
 * executed the transfer.  Does nothing if the hold is already on file; use
 * #TALER_AUDITORDB_update_aml_hold() to refresh it.
 *
 * @param pg the database context
 * @param wtid the wire transfer that was not executed
 * @param wire_target_h_payto account the transfer should go to
 * @param account payto URI of that account
 * @param amount what the exchange still owes on the transfer
 * @param deferral_reason why the exchange says it has not paid, a
 *        `enum TALER_EXCHANGEDB_DeferralReason` value
 * @param legitimization_measure_serial_id that measure, or 0
 * @return query result status
 */
enum GNUNET_DB_QueryStatus
TALER_AUDITORDB_insert_aml_hold (
  struct TALER_AUDITORDB_PostgresContext *pg,
  const struct TALER_WireTransferIdentifierRawP *wtid,
  const struct TALER_FullPaytoHashP *wire_target_h_payto,
  const struct TALER_FullPayto account,
  const struct TALER_Amount *amount,
  uint32_t deferral_reason,
  uint64_t legitimization_measure_serial_id);

#endif
