#!/usr/bin/env python3
"""
Debug script to see what's happening at each stage of conversion
"""

import cadar


def debug_laa_conversion():
    """Debug the conversion of 'laa' step by step"""

    print("Debugging 'laa' conversion...")
    print("=" * 50)

    # Test with detailed information if available
    try:
        # Try to get detailed conversion info
        cadar_processor = cadar.CaDaR()

        # If there's a method to get detailed info, use it
        if hasattr(cadar_processor, "transliterate_with_details"):
            details = cadar_processor.transliterate_with_details("laa", "arabic")
            print(f"Original: {details.original}")
            print(f"Normalized: {details.normalized}")
            print(f"Generated: {details.generated}")
            print(f"Final: {details.final_output}")
        else:
            print("No detailed method available, using basic conversion")

    except Exception as e:
        print(f"Error getting details: {e}")

    # Basic conversion
    print("\nBasic conversion:")
    arabic = cadar.bizi2ara("laa")
    print(f"laa → {arabic}")

    # Check each character
    print(f"Arabic characters: {[c for c in arabic]}")

    # Try back conversion
    back = cadar.ara2bizi(arabic)
    print(f"{arabic} → {back}")


if __name__ == "__main__":
    debug_laa_conversion()
