/*
  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/exchange/post-management-denominations-H_DENOM_PUB-revoke.h
 * @brief C interface for POST /management/denominations/$H_DENOM_PUB/revoke
 * @author Christian Grothoff
 */
#ifndef _TALER_EXCHANGE__POST_MANAGEMENT_DENOMINATIONS_H_DENOM_PUB_REVOKE_H
#define _TALER_EXCHANGE__POST_MANAGEMENT_DENOMINATIONS_H_DENOM_PUB_REVOKE_H

#include <taler/exchange/common.h>

/**
 * Handle for an operation to POST
 * /management/denominations/$H_DENOM_PUB/revoke.
 */
struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle;


/**
 * Set up POST /management/denominations/$H_DENOM_PUB/revoke operation.
 * Note that you must explicitly start the operation after setup.
 *
 * @param ctx the context
 * @param url HTTP base URL for the exchange
 * @param h_denom_pub hash of the denomination public key that was revoked
 * @param master_sig signature affirming the revocation
 * @return handle to operation, NULL on error
 */
struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle *
TALER_EXCHANGE_post_management_denominations_revoke_create (
  struct GNUNET_CURL_Context *ctx,
  const char *url,
  const struct TALER_DenominationHashP *h_denom_pub,
  const struct TALER_MasterSignatureP *master_sig);


/**
 * Response from a POST /management/denominations/$DENOM/revoke request.
 */
struct TALER_EXCHANGE_PostManagementDenominationsRevokeResponse
{
  /**
   * HTTP response data
   */
  struct TALER_EXCHANGE_HttpResponse hr;
};


#ifndef TALER_EXCHANGE_POST_MANAGEMENT_DENOMINATIONS_REVOKE_RESULT_CLOSURE
/**
 * Type of the closure used by
 * the #TALER_EXCHANGE_PostManagementDenominationsRevokeCallback.
 */
#define TALER_EXCHANGE_POST_MANAGEMENT_DENOMINATIONS_REVOKE_RESULT_CLOSURE void
#endif /* TALER_EXCHANGE_POST_MANAGEMENT_DENOMINATIONS_REVOKE_RESULT_CLOSURE */

/**
 * Type of the function that receives the result of a
 * POST /management/denominations/$H_DENOM_PUB/revoke request.
 *
 * @param cls closure
 * @param result result returned by the HTTP server
 */
typedef void
(*TALER_EXCHANGE_PostManagementDenominationsRevokeCallback)(
  TALER_EXCHANGE_POST_MANAGEMENT_DENOMINATIONS_REVOKE_RESULT_CLOSURE *cls,
  const struct
  TALER_EXCHANGE_PostManagementDenominationsRevokeResponse *result);


/**
 * Start POST /management/denominations/$H_DENOM_PUB/revoke operation.
 *
 * @param[in,out] pmdrh 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_denominations_revoke_start (
  struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle *pmdrh,
  TALER_EXCHANGE_PostManagementDenominationsRevokeCallback cb,
  TALER_EXCHANGE_POST_MANAGEMENT_DENOMINATIONS_REVOKE_RESULT_CLOSURE *cb_cls);


/**
 * Cancel POST /management/denominations/$H_DENOM_PUB/revoke operation.  This
 * function must not be called by clients after the
 * TALER_EXCHANGE_PostManagementDenominationsRevokeCallback has been invoked
 * (as in those cases it'll be called internally by the implementation
 * already).
 *
 * @param[in] pmdrh operation to cancel
 */
void
TALER_EXCHANGE_post_management_denominations_revoke_cancel (
  struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle *pmdrh);


#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_DENOMINATIONS_H_DENOM_PUB_REVOKE_H */
