import 'package:crypto_font_icons/crypto_font_icons.dart';
import 'package:fhub/backend/DataManager.dart';
import 'package:fhub/backend/DebugHelper.dart';
import 'package:flutter/material.dart';

class Helpers{

  static IconData GetIconForCrypto(String val){
    switch(val){
      case "BTC":
        return CryptoFontIcons.BTC;
        break;
      case "ETH":
        return CryptoFontIcons.ETH;
        break;
      case "XRP":
        return CryptoFontIcons.XRP;
        break;
      case "DOGE":
        return CryptoFontIcons.DOGE;
        break;
      case "LTC":
        return CryptoFontIcons.LTC;
        break;
        case "BCH":
        return CryptoFontIcons.AUR;
        break;
    }

    return CryptoFontIcons.BTC;
  }

  static String GetIconForGame(String name){
    DataManager.AllGames.forEach((element) {
      if(element['name'] == name){
        return element['thumbnail'];
      }
    });

    return "";
  }

  static dynamic GetGameFromCode(String code){
    for (var value in DataManager.AllGames) {
      // Debug.Log(value);
      if(code == value['code']){
        return value;
      }
    }

    return null;
  }

  static dynamic GetGameFromID(int id){
    for (var value in DataManager.AllGames) {
      Debug.Log(value);
      if(id == value['id']){
        return value;
      }
    }
  }

  // static double CryptoToDollars({required double amount, required String Crypto}){
  //   if(Hoarder.cryptoRates==null){Debug.Log("Crypto rates haven't been updated yet"); return 0;}
  //   Debug.Log(Hoarder.cryptoRates);
  //   if(Hoarder.cryptoRates[Crypto] == null){
  //     Debug.Log("$Crypto not found in ${Hoarder.cryptoRates}");
  //     return 0;
  //   }
  //   return amount * double.parse(Hoarder.cryptoRates[Crypto]);
  // }
  //
  // static double SatsToCoin(int sats){
  //   return sats.toDouble() * 0.00000001;
  // }
}