def send_sms(mobile, template, context):
    # TODO: Replace with actual SMS provider logic (like Msg91, TextLocal, Twilio)
    rendered = template.format(**context)
    print(f"[SMS] To {mobile}: {rendered}")

def send_whatsapp(mobile, template, context):
    # TODO: Replace with actual WhatsApp provider logic
    rendered = template.format(**context)
    print(f"[WhatsApp] To {mobile}: {rendered}")

from django.core.mail import EmailMessage
from django.template.loader import render_to_string
from django.conf import settings
import threading

import threading

def send_html_email(subject, to_email, template_name, context):
    # print(f"📭 Skipped email to {to_email} - EMAILS DISABLED FOR OFFICE NETWORK")
    # return  # Disable for now
    # print(template_name)
    # print(context)
    def _send():
        try:
            body = render_to_string(template_name, context)
            email = EmailMessage(
                subject=subject,
                body=body,
                from_email=settings.DEFAULT_FROM_EMAIL,
                to=[to_email]
            )
            email.content_subtype = 'html'
            email.send()
            # print(f"[OK] Email sent to {to_email} with subject '{subject}'")
        except Exception as e:
            print(f"[ERR] Email sending failed: {e}")
            

    # Run in separate thread
    threading.Thread(target=_send).start()


