/*
 This file is part of GNU Taler
 (C) 2019-2023 Taler Systems S.A.

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

 GNU 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
 GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
 */

import { TalerExchangeHttpClient } from "@gnu-taler/taler-util";

/**
 * Protocol version spoken with the exchange.
 *
 * Uses libtool's current:revision:age versioning.
 */
export const WALLET_EXCHANGE_PROTOCOL_VERSION =
  TalerExchangeHttpClient.SUPPORTED_EXCHANGE_PROTOCOL_VERSION;

/**
 * Protocol version spoken with the merchant.
 *
 * Uses libtool's current:revision:age versioning.
 */
export const WALLET_MERCHANT_PROTOCOL_VERSION = "5:0:1";

/**
 * Protocol version spoken with the bank (corebank API).
 *
 * Uses libtool's current:revision:age versioning.
 */
export const WALLET_COREBANK_API_PROTOCOL_VERSION = "2:0:0";

/**
 * Protocol version spoken with the bank (conversion API).
 *
 * Uses libtool's current:revision:age versioning.
 */
export const WALLET_BANK_CONVERSION_API_PROTOCOL_VERSION = "2:0:0";

/**
 * Libtool version of the wallet-core API.
 */
export const WALLET_CORE_API_PROTOCOL_VERSION = "7:0:0";

/**
 * Libtool rules:
 *
 * If the library source code has changed at all since the last update,
 *     then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
 * If any interfaces have been added, removed, or changed since the last
 *     update, increment current, and set revision to 0.
 * If any interfaces have been added since the last public release, then
 *     increment age.
 * If any interfaces have been removed or changed since the last public
 *     release, then set age to 0.
 */

// Provided either by bundler or in the next lines.
declare global {
  const walletCoreBuildInfo: {
    implementationSemver: string;
    implementationGitHash: string;
  };
}

// Provide walletCoreBuildInfo if the bundler does not override it.
if (!("walletCoreBuildInfo" in globalThis)) {
  (globalThis as any).walletCoreBuildInfo = {
    implementationSemver: "unknown",
    implementationGitHash: "unknown",
  } satisfies typeof walletCoreBuildInfo;
}
