import os
from django.shortcuts import render
from .models import RadioConfig

def home(request):
    """Render the landing screen for La Morenita Radio."""
    config = RadioConfig.objects.first()
    
    # Provide default data if not configured in admin yet
    if not config:
        config = {
            "title": "La Morenita Radio",
            "stream_url": "https://streaming.hostpannel.lat:8054/stream",
            "whatsapp_number": "+52 844 218 8814",
            "facebook_url": "https://www.facebook.com/profile.php?id=61583511337947",
            "tiktok_url": "https://www.tiktok.com/@chikipapiradio",
        }

    context = {
        "config": config,
        "project_description": os.getenv("PROJECT_DESCRIPTION", "La Morenita Radio - Música 24/7"),
    }
    return render(request, "core/index.html", context)
