/*
  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-wire-disable.h
 * @brief C interface for POST /management/wire/disable
 * @author Christian Grothoff
 */
#ifndef _TALER_EXCHANGE__POST_MANAGEMENT_WIRE_DISABLE_H
#define _TALER_EXCHANGE__POST_MANAGEMENT_WIRE_DISABLE_H

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

/**
 * Handle for an operation to POST /management/wire/disable.
 */
struct TALER_EXCHANGE_PostManagementWireDisableHandle;


/**
 * Set up POST /management/wire/disable operation.
 * Note that you must explicitly start the operation after setup.
 *
 * @param ctx the context
 * @param exchange_url HTTP base URL for the exchange
 * @param payto_uri RFC 8905 URI of the exchange's bank account
 * @param validity_end when was this decided?
 * @param master_sig signature affirming the wire disablement
 *        of purpose #TALER_SIGNATURE_MASTER_DEL_WIRE
 * @return handle to operation, NULL on error
 */
struct TALER_EXCHANGE_PostManagementWireDisableHandle *
TALER_EXCHANGE_post_management_wire_disable_create (
  struct GNUNET_CURL_Context *ctx,
  const char *exchange_url,
  const struct TALER_FullPayto payto_uri,
  struct GNUNET_TIME_Timestamp validity_end,
  const struct TALER_MasterSignatureP *master_sig);


/**
 * Response from an exchange account/disable operation.
 */
struct TALER_EXCHANGE_PostManagementWireDisableResponse
{
  /**
   * HTTP response data.
   */
  struct TALER_EXCHANGE_HttpResponse hr;
};


#ifndef TALER_EXCHANGE_POST_MANAGEMENT_WIRE_DISABLE_RESULT_CLOSURE
/**
 * Type of the closure used by
 * the #TALER_EXCHANGE_PostManagementWireDisableCallback.
 */
#define TALER_EXCHANGE_POST_MANAGEMENT_WIRE_DISABLE_RESULT_CLOSURE void
#endif /* TALER_EXCHANGE_POST_MANAGEMENT_WIRE_DISABLE_RESULT_CLOSURE */

/**
 * Type of the function that receives the result of a
 * POST /management/wire/disable request.
 *
 * @param cls closure
 * @param result result returned by the HTTP server
 */
typedef void
(*TALER_EXCHANGE_PostManagementWireDisableCallback)(
  TALER_EXCHANGE_POST_MANAGEMENT_WIRE_DISABLE_RESULT_CLOSURE *cls,
  const struct TALER_EXCHANGE_PostManagementWireDisableResponse *result);


/**
 * Start POST /management/wire/disable operation.
 *
 * @param[in,out] pmwdh 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_wire_disable_start (
  struct TALER_EXCHANGE_PostManagementWireDisableHandle *pmwdh,
  TALER_EXCHANGE_PostManagementWireDisableCallback cb,
  TALER_EXCHANGE_POST_MANAGEMENT_WIRE_DISABLE_RESULT_CLOSURE *cb_cls);


/**
 * Cancel POST /management/wire/disable operation.  This function must not be
 * called by clients after the
 * TALER_EXCHANGE_PostManagementWireDisableCallback has been invoked (as in
 * those cases it'll be called internally by the implementation already).
 *
 * @param[in] pmwdh operation to cancel
 */
void
TALER_EXCHANGE_post_management_wire_disable_cancel (
  struct TALER_EXCHANGE_PostManagementWireDisableHandle *pmwdh);



#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_WIRE_DISABLE_H */
