from typing import Tuple
from typing import Optional
from typing import Any


def validate_coin(coin: str, coins_dct: dict) -> Tuple[str, Optional[Any]]:
    """Helper method that validates if proper coin id or symbol was provided [Source: CoinPaprika]

    Parameters
    ----------
    coin: str
        id or symbol of coin for CoinPaprika
    coins_dct: dict
        dictionary of coins

    Returns
    -------
    Tuple[str,str]
        coin id, coin symbol
    """

    coin_found, symbol = None, None
    if coin in coins_dct:
        coin_found = coin
        symbol = coins_dct.get(coin_found)
    else:
        for key, value in coins_dct.items():
            if coin.upper() == value:
                coin_found = key
                symbol = value

    if not coin_found:
        raise ValueError(f"Could not find coin with given id: {coin}\n")
    print(f"Coin found : {coin_found} with symbol {symbol}\n")
    return coin_found, symbol