/*
 * This file is part of Bisq.
 *
 * Bisq 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 of the License, or (at
 * your option) any later version.
 *
 * Bisq 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 Bisq. If not, see <http://www.gnu.org/licenses/>.
 */

package bisq.core.util;

import bisq.core.app.BisqEnvironment;
import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.GlobalSettings;
import bisq.core.locale.Res;
import bisq.core.monetary.Altcoin;
import bisq.core.monetary.Price;
import bisq.core.offer.OfferPayload;

import bisq.network.p2p.NodeAddress;

import bisq.common.util.MathUtils;

import org.bitcoinj.core.Coin;
import org.bitcoinj.core.Monetary;
import org.bitcoinj.utils.Fiat;
import org.bitcoinj.utils.MonetaryFormat;

import javax.inject.Inject;
import javax.inject.Singleton;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.lang3.time.DurationFormatUtils;

import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;

import java.math.BigDecimal;

import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.stream.Collectors;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

import org.jetbrains.annotations.NotNull;

@Slf4j
@Singleton
public class BSFormatter {

    // We don't support localized formatting. Format is always using "." as decimal mark and no grouping separator.
    // Input of "," as decimal mark (like in german locale) will be replaced with ".".
    // Input of a group separator (1,123,45) lead to an validation error.
    // Note: BtcFormat was intended to be used, but it lead to many problems (automatic format to mBit,
    // no way to remove grouping separator). It seems to be not optimal for user input formatting.
    @Getter
    protected MonetaryFormat monetaryFormat;

    //  protected String currencyCode = CurrencyUtil.getDefaultFiatCurrencyAsCode();


    @Inject
    public BSFormatter() {
        monetaryFormat = BisqEnvironment.getParameters().getMonetaryFormat();
    }


    ///////////////////////////////////////////////////////////////////////////////////////////
    // BTC
    ///////////////////////////////////////////////////////////////////////////////////////////

    public String formatCoin(Coin coin) {
        return formatCoin(coin, -1);
    }

    @NotNull
    public String formatCoin(Coin coin, int decimalPlaces) {
        return formatCoin(coin, decimalPlaces, false, 0);
    }

    public String formatCoin(Coin coin, int decimalPlaces, boolean decimalAligned, int maxNumberOfDigits) {
        return FormattingUtils.formatCoin(coin, decimalPlaces, decimalAligned, maxNumberOfDigits, monetaryFormat);
    }

    public String formatCoinWithCode(Coin coin) {
        return FormattingUtils.formatCoinWithCode(coin, monetaryFormat);
    }

    public String formatCoinWithCode(long value) {
        return FormattingUtils.formatCoinWithCode(Coin.valueOf(value), monetaryFormat);
    }

    public static String getDateFromBlockHeight(long blockHeight) {
        long now = new Date().getTime();
        SimpleDateFormat dateFormatter = new SimpleDateFormat("dd MMM", Locale.getDefault());
        SimpleDateFormat timeFormatter = new SimpleDateFormat("HH:mm", Locale.getDefault());
        return FormattingUtils.formatDateTime(new Date(now + blockHeight * 10 * 60 * 1000L), dateFormatter, timeFormatter);
    }
}

@@ -749,900 +749,132 @@
 ort 
-bisq.core.locale.CurrencyUtil;%0Aimport bisq.core.locale.GlobalSettings;%0Aimport bisq.core.locale.Res;%0Aimport bisq.core.monetary.Altcoin;%0Aimport bisq.core.monetary.Price;%0Aimport bisq.core.offer.OfferPayload;%0A%0Aimport bisq.network.p2p.NodeAddress;%0A%0Aimport bisq.common.util.MathUtils;%0A%0Aimport org.bitcoinj.core.Coin;%0Aimport org.bitcoinj.core.Monetary;%0Aimport org.bitcoinj.utils.Fiat;%0Aimport org.bitcoinj.utils.MonetaryFormat;%0A%0Aimport javax.inject.Inject;%0Aimport javax.inject.Singleton;%0A%0Aimport org.apache.commons.lang3.StringUtils;%0Aimport org.apache.commons.lang3.time.DateUtils;%0Aimport org.apache.commons.lang3.time.DurationFormatUtils;%0A%0Aimport java.text.DateFormat;%0Aimport java.text.DecimalFormat;%0Aimport java.text.SimpleDateFormat;%0A%0Aimport java.math.BigDecimal;%0A%0Aimport java.util.Date;%0Aimport java.util.List;%0Aimport java.util.Locale;%0Aimport java.util.TimeZone;%0Aimport java.util.stream.Collectors
+org.bitcoinj.core.Coin;%0Aimport org.bitcoinj.utils.MonetaryFormat;%0A%0Aimport javax.inject.Inject;%0Aimport javax.inject.Singleton
 ;%0A%0Ai
@@ -2705,434 +2705,7 @@
    %7D
-%0A%0A    public static String getDateFromBlockHeight(long blockHeight) %7B%0A        long now = new Date().getTime();%0A        SimpleDateFormat dateFormatter = new SimpleDateFormat(%22dd MMM%22, Locale.getDefault());%0A        SimpleDateFormat timeFormatter = new SimpleDateFormat(%22HH:mm%22, Locale.getDefault());%0A        return FormattingUtils.formatDateTime(new Date(now + blockHeight * 10 * 60 * 1000L), dateFormatter, timeFormatter);%0A    %7D
 %0A%7D%0A

Remove dead code from BSFormatter