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

  TALER 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.

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

  You should have received a copy of the GNU Affero General Public License along with
  TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
 */
/**
 * @file include/taler/taler-exchange/post-management-aml-officers.h
 * @brief C interface for POST /management/aml-officers
 * @author Christian Grothoff
 */
#ifndef _TALER_EXCHANGE__POST_MANAGEMENT_AML_OFFICERS_H
#define _TALER_EXCHANGE__POST_MANAGEMENT_AML_OFFICERS_H

#include <taler/taler-exchange/common.h>

/**
 * Handle for an operation to POST /management/aml-officers.
 */
struct TALER_EXCHANGE_PostManagementAmlOfficersHandle;


/**
 * Set up POST /management/aml-officers operation.
 * Note that you must explicitly start the operation after setup.
 *
 * @param ctx the context
 * @param url HTTP base URL for the exchange
 * @param officer_pub the public signing key of the officer
 * @param officer_name name of the officer
 * @param change_date when to affect the status change
 * @param is_active true to enable the officer
 * @param read_only true to only allow read-only access
 * @param master_sig signature affirming the change
 * @return handle to operation, NULL on error
 */
struct TALER_EXCHANGE_PostManagementAmlOfficersHandle *
TALER_EXCHANGE_post_management_aml_officers_create (
  struct GNUNET_CURL_Context *ctx,
  const char *url,
  const struct TALER_AmlOfficerPublicKeyP *officer_pub,
  const char *officer_name,
  struct GNUNET_TIME_Timestamp change_date,
  bool is_active,
  bool read_only,
  const struct TALER_MasterSignatureP *master_sig);


/**
 * Response from a POST /management/aml-officers request.
 */
struct TALER_EXCHANGE_PostManagementAmlOfficersResponse
{
  /**
   * HTTP response data
   */
  struct TALER_EXCHANGE_HttpResponse hr;
};


#ifndef TALER_EXCHANGE_POST_MANAGEMENT_AML_OFFICERS_RESULT_CLOSURE
/**
 * Type of the closure used by
 * the #TALER_EXCHANGE_PostManagementAmlOfficersCallback.
 */
#define TALER_EXCHANGE_POST_MANAGEMENT_AML_OFFICERS_RESULT_CLOSURE void
#endif /* TALER_EXCHANGE_POST_MANAGEMENT_AML_OFFICERS_RESULT_CLOSURE */

/**
 * Type of the function that receives the result of a
 * POST /management/aml-officers request.
 *
 * @param cls closure
 * @param result result returned by the HTTP server
 */
typedef void
(*TALER_EXCHANGE_PostManagementAmlOfficersCallback)(
  TALER_EXCHANGE_POST_MANAGEMENT_AML_OFFICERS_RESULT_CLOSURE *cls,
  const struct TALER_EXCHANGE_PostManagementAmlOfficersResponse *result);


/**
 * Start POST /management/aml-officers operation.
 *
 * @param[in,out] pmaoh operation to start
 * @param cb function to call with the exchange's result
 * @param cb_cls closure for @a cb
 * @return status code, #TALER_EC_NONE on success
 */
enum TALER_ErrorCode
TALER_EXCHANGE_post_management_aml_officers_start (
  struct TALER_EXCHANGE_PostManagementAmlOfficersHandle *pmaoh,
  TALER_EXCHANGE_PostManagementAmlOfficersCallback cb,
  TALER_EXCHANGE_POST_MANAGEMENT_AML_OFFICERS_RESULT_CLOSURE *cb_cls);


/**
 * Cancel POST /management/aml-officers operation.  This function must not be
 * called by clients after the
 * TALER_EXCHANGE_PostManagementAmlOfficersCallback has been invoked (as in
 * those cases it'll be called internally by the implementation already).
 *
 * @param[in] pmaoh operation to cancel
 */
void
TALER_EXCHANGE_post_management_aml_officers_cancel (
  struct TALER_EXCHANGE_PostManagementAmlOfficersHandle *pmaoh);


#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_AML_OFFICERS_H */
