"""
Cryptocurrency Utils
"""
import uuid
from typing import Dict


class CryptoWallet:
    """Generate and manage crypto wallets"""
    
    USDT_ADDRESS = "TN3W4H6rK8m1o9L2c3Q5r6S7t8U9v0W1x2"  # TRC-20 USDT on TRON
    TRX_ADDRESS = "TR7NHqjeKQxGTCi8q8ZY4pL8otSAFeuS9d"  # TRON Address
    
    @staticmethod
    def get_usdt_wallet() -> Dict[str, str]:
        """Get USDT wallet info"""
        return {
            'address': CryptoWallet.USDT_ADDRESS,
            'currency': 'USDT',
            'network': 'TRC-20 (Tron)',
            'description': 'تتر روی شبکه ترون'
        }
    
    @staticmethod
    def get_trx_wallet() -> Dict[str, str]:
        """Get TRX wallet info"""
        return {
            'address': CryptoWallet.TRX_ADDRESS,
            'currency': 'TRX',
            'network': 'Tron',
            'description': 'ترون'
        }
    
    @staticmethod
    def generate_transaction_id() -> str:
        """Generate unique transaction ID"""
        return str(uuid.uuid4())[:12]


class PriceConverter:
    """Convert between currencies"""
    
    # Exchange rates (placeholder - should be updated from API)
    RATES = {
        'TOMAN_TO_USDT': 1/42000,  # Approximate
        'USDT_TO_TOMAN': 42000,
        'TRX_TO_USDT': 0.15,
        'USDT_TO_TRX': 6.666
    }
    
    @staticmethod
    def toman_to_usdt(amount_toman: float) -> float:
        """Convert Toman to USDT"""
        return amount_toman * PriceConverter.RATES['TOMAN_TO_USDT']
    
    @staticmethod
    def usdt_to_toman(amount_usdt: float) -> float:
        """Convert USDT to Toman"""
        return amount_usdt * PriceConverter.RATES['USDT_TO_TOMAN']
