package main

import (
	"log"
	"os"

	"codeberg.org/mapleopentech/monorepo/cloud/maplefile-backend/app"
	"codeberg.org/mapleopentech/monorepo/cloud/maplefile-backend/config"
)

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

	// Initialize application using Wire
	application, err := app.InitializeApplication(cfg)
	if err != nil {
		log.Fatalf("Failed to initialize application: %v", err)
		os.Exit(1)
	}

	// Start the application
	log.Println("Starting MapleFile Backend with Wire DI...")
	if err := application.Start(); err != nil {
		log.Fatalf("Application failed: %v", err)
		os.Exit(1)
	}
}
