import { Bucket } from "@google-cloud/storage"
import { Storage } from "@google-cloud/storage"
import * as path from "path"

/**
 * Sube contenido de texto directamente a un bucket de GCS.
 * @param bucket Instancia de Bucket
 * @param destination Ruta destino dentro del bucket (incluye carpeta/nombre)
 * @param textContent Contenido textual a subir
 */
export async function uploadTextToBucket(
  bucket: Bucket,
  destination: string,
  textContent: string
): Promise<void> {
  const file = bucket.file(destination)

  await file.save(textContent, {
    resumable: false,
    contentType: "text/plain",
  })

  console.log(`✅ Texto subido a gs://${bucket.name}/${destination}`)
}
