from django.core.management.base import BaseCommand
from core.models import SiteSettings, Cryptocurrency
import decimal

class Command(BaseCommand):
    help = 'Seed initial site settings and data'

    def handle(self, *args, **options):
        # Site Settings
        settings, created = SiteSettings.objects.get_or_create(id=1)
        settings.site_name = "BitCrypto"
        settings.customer_service_url = "https://t.me/bitcrypto_support"
        settings.terms_content = "欢迎使用 BitCrypto。通过访问我们的平台，您同意遵守以下条款：1. 用户必须年满 18 岁。2. 您对账户的安全负全部责任。3. 加密货币交易具有高度风险..."
        settings.privacy_content = "我们重视您的隐私。BitCrypto 仅收集必要的个人信息以提供服务。我们使用先进的加密技术保护您的数据，绝不向第三方出售您的个人信息。"
        settings.save()
        
        self.stdout.write(self.style.SUCCESS('Successfully seeded site settings'))

        # Ensure BTC exists
        btc, created = Cryptocurrency.objects.get_or_create(symbol="BTC")
        btc.name = "Bitcoin"
        btc.current_price = decimal.Decimal("48000.00")
        btc.save()

        self.stdout.write(self.style.SUCCESS('Successfully seeded cryptocurrencies'))
