package com.example.lexilearn.utils

import com.google.firebase.storage.FirebaseStorage

fun getFirebaseImageUrl(path: String, callback: (String?) -> Unit) {
    val storageReference = FirebaseStorage.getInstance().reference.child(path)
    storageReference.downloadUrl
        .addOnSuccessListener { uri ->
            println("🔥 towtow Firebase Image URL: $uri") // 🔥 Debug: Cek URL yang dihasilkan
            callback(uri.toString()) // ✅ Kirim URL ke callback
        }
        .addOnFailureListener { exception ->
            println("❌ towtow ${path} Firebase Error: ${exception.message}") // 🔥 Debug: Cek jika error terjadi
            callback(null) // ❌ Jika gagal, callback NULL
        }
}
