package main

import (
	"log"

	"github.com/gin-gonic/gin"
	"tencenthw/pkg/config"
	"tencenthw/pkg/handler"
)

func main() {
	// Load configuration
	cfg, err := config.LoadConfig()
	if err != nil {
		log.Fatalf("Failed to load configuration: %v", err)
	}

	// Initialize handler
	ocrHandler := handler.NewOCRHandler(
		cfg.TencentSecretID,
		cfg.TencentSecretKey,
		cfg.GeminiAPIKey,
		cfg.APIKey,
	)

	// Setup Gin router
	r := gin.Default()

	// Register routes
	r.POST("/ocr", ocrHandler.HandleOCR)

	// Start server
	if err := r.Run("localhost:8080"); err != nil {
		log.Fatalf("Failed to start server: %v", err)
	}
}