/*
   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/merchant-database/insert_tos_accepted_early.h
 * @brief implementation of the insert_tos_accepted_early function for Postgres
 * @author Christian Grothoff
 */
#ifndef MERCHANT_DATABASE_INSERT_TOS_ACCEPTED_EARLY_H
#define MERCHANT_DATABASE_INSERT_TOS_ACCEPTED_EARLY_H

#include <taler/taler_util.h>
#include <taler/taler_json_lib.h>
#include "merchantdb_lib.h"


struct TALER_MERCHANTDB_PostgresContext;

/**
 * Record that the user has accepted version @a tos_version
 * of the terms of service of the exchange identified by
 * @a exchange_url ahead of the regular KYC flow.  If an
 * acceptance already exists for the given @a merchant_id
 * and @a exchange_url, it is updated to the new
 * @a tos_version.
 *
 * @param pg database context
 * @param merchant_id merchant backend instance ID
 * @param exchange_url base URL of the exchange the user
 *        accepted the terms of service for
 * @param tos_version ``Taler-Terms-Version`` of the
 *        terms of service the user accepted
 * @return database result code
 */
enum GNUNET_DB_QueryStatus
TALER_MERCHANTDB_insert_tos_accepted_early (
  struct TALER_MERCHANTDB_PostgresContext *pg,
  const char *merchant_id,
  const char *exchange_url,
  const char *tos_version);

#endif
