#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test different language code formats
"""
import sys
import os
from dotenv import load_dotenv

sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
load_dotenv()

import asyncio
from whatsapp import WhatsAppService, WhatsAppError

async def test_language_code():
    """Test with he_IL language code"""
    
    print("\n[Test] Trying with language code: he_IL")
    print("=" * 80)
    
    try:
        service = WhatsAppService()
    except WhatsAppError as e:
        print(f"[ERROR] {e}")
        return
    
    try:
        result = await service.send_template_message(
            to_phone="0504370045",
            template_name="wedding_invitation",
            language_code="he_IL",  # Try with locale
            parameters=[
                "דביר",
                "דביר",
                "שרה",
                "אולם בן-גוריון",
                "15/06",
                "18:30",
                "https://invy.dvirlabs.com/guest?event=ee648859"
            ]
        )
        
        print("[SUCCESS] Message sent!")
        print(f"Message ID: {result.get('message_id')}")
        
    except WhatsAppError as e:
        print(f"[FAILED] {e}")

asyncio.run(test_language_code())
