// SPDX-FileCopyrightText: © 2026 LEDGER SAS
// SPDX-License-Identifier: Apache-2.0

import type { CoinConfig, Context, CurrencyConfig } from '@ledgerhq/coin-module-framework/config'
import buildCoinConfig from '@ledgerhq/coin-module-framework/config'

export type TezosConfig = {
  baker: {
    url: string
  }
  explorer: {
    url: string
    maxTxQuery: number
  }
  node: {
    url: string
  }
  fees: {
    minGasLimit: number
    minRevealGasLimit: number
    minStorageLimit: number
    minFees: number
    minEstimatedFees: number
  }
}

export type TezosCoinConfig = CurrencyConfig & TezosConfig

/** The {@link Context} threaded through the coin-tezos low layers (ADR-019). */
export type TezosContext = Context<TezosCoinConfig>

const coinConfig: {
  setCoinConfig: (config: CoinConfig<TezosCoinConfig>) => void
  getCoinConfig: (currencyId?: string) => TezosCoinConfig
} = buildCoinConfig<TezosCoinConfig>()

export default coinConfig
