/*
  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 Lesser General Public License as published by the Free Software
  Foundation; either version 2.1, 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 Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public License along with
  TALER; see the file COPYING.LGPL.  If not, see
  <http://www.gnu.org/licenses/>
*/
/**
 * @file src/include/taler/merchant/patch-private-orders-ORDER_ID-forget.h
 * @brief C interface for PATCH /private/orders/$ORDER_ID/forget
 * @author Christian Grothoff
 */
#ifndef _TALER_MERCHANT__PATCH_PRIVATE_ORDERS_ORDER_ID_FORGET_H
#define _TALER_MERCHANT__PATCH_PRIVATE_ORDERS_ORDER_ID_FORGET_H

#include <taler/merchant/common.h>


/**
 * Handle for a PATCH /private/orders/$ORDER_ID/forget operation.
 */
struct TALER_MERCHANT_PatchPrivateOrdersForgetHandle;


/**
 * Set up PATCH /private/orders/$ORDER_ID/forget operation.
 * Note that you must explicitly start the operation after setup.
 *
 * @param ctx the context
 * @param url base URL of the merchant backend
 * @param order_id identifier of the order
 * @param fields_length number of field paths in @a fields
 * @param fields array of JSON pointer paths to redact
 * @return handle to operation, NULL on error
 */
struct TALER_MERCHANT_PatchPrivateOrdersForgetHandle *
TALER_MERCHANT_patch_private_orders_forget_create (
  struct GNUNET_CURL_Context *ctx,
  const char *url,
  const char *order_id,
  unsigned int fields_length,
  const char *fields[static fields_length]);


/**
 * Response details for a PATCH /private/orders/$ORDER_ID/forget request.
 */
struct TALER_MERCHANT_PatchPrivateOrdersForgetResponse
{
  /**
   * HTTP response details.
   */
  struct TALER_MERCHANT_HttpResponse hr;
};


#ifndef TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE
/**
 * Type of the closure used by
 * the #TALER_MERCHANT_PatchPrivateOrdersForgetCallback.
 */
#define TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE void
#endif /* TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE */

/**
 * Callback for a PATCH /private/orders/$ORDER_ID/forget request.
 *
 * @param cls closure
 * @param result response details
 */
typedef void
(*TALER_MERCHANT_PatchPrivateOrdersForgetCallback)(
  TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE *cls,
  const struct TALER_MERCHANT_PatchPrivateOrdersForgetResponse *result);


/**
 * Start PATCH /private/orders/$ORDER_ID/forget operation.
 *
 * @param[in,out] handle operation to start
 * @param cb function to call with the result
 * @param cb_cls closure for @a cb
 * @return status code, #TALER_EC_NONE on success
 */
enum TALER_ErrorCode
TALER_MERCHANT_patch_private_orders_forget_start (
  struct TALER_MERCHANT_PatchPrivateOrdersForgetHandle *handle,
  TALER_MERCHANT_PatchPrivateOrdersForgetCallback cb,
  TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE *cb_cls);


/**
 * Cancel PATCH /private/orders/$ORDER_ID/forget operation.
 * This function must not be called by clients after the
 * callback has been invoked.
 *
 * @param[in] handle operation to cancel
 */
void
TALER_MERCHANT_patch_private_orders_forget_cancel (
  struct TALER_MERCHANT_PatchPrivateOrdersForgetHandle *handle);


#endif /* _TALER_MERCHANT__PATCH_PRIVATE_ORDERS_ORDER_ID_FORGET_H */
