package main

import (
	"fmt"
	"log"
	"os"

	"github.com/42wim/matterbridge/bridge/jackbox"
	"github.com/sirupsen/logrus"
)

func main() {
	// Enable debug logging
	logrus.SetLevel(logrus.DebugLevel)
	
	// Generate a test image
	log.Println("Generating test room code image...")
	imageData, err := jackbox.GenerateRoomCodeImage("TEST", "Quiplash 3")
	if err != nil {
		log.Fatalf("Failed to generate image: %v", err)
	}
	
	log.Printf("Generated %d bytes of GIF data", len(imageData))
	
	// Save locally for verification
	if err := os.WriteFile("test_upload.gif", imageData, 0644); err != nil {
		log.Fatalf("Failed to save test file: %v", err)
	}
	log.Println("Saved test_upload.gif locally")
	
	// Upload to Kosmi
	log.Println("Uploading to Kosmi CDN...")
	url, err := jackbox.UploadImageToKosmi(imageData, "test_roomcode.gif")
	if err != nil {
		log.Fatalf("Upload failed: %v", err)
	}
	
	fmt.Printf("\n✅ SUCCESS! Uploaded to: %s\n", url)
	fmt.Println("\nPlease check the URL in your browser to verify it's animated!")
}

