package main

import (
	"cargo-erp-backend/internal/config"
	"cargo-erp-backend/internal/database"
	"cargo-erp-backend/internal/handlers"
	"cargo-erp-backend/internal/logger"
	"cargo-erp-backend/pkg/helpers"
)

func main() {
	//load config
	AppConfig := config.NewConfig()
	AppConfig.Load()

	//logger load
	LoggerApp := logger.NewLogger(AppConfig)
	LoggerApp.Init()
	DBLogger := LoggerApp.Get("DB")
	APPLogger := LoggerApp.Get("APP")

	//db connection
	db := database.NewDatabase(AppConfig, DBLogger, APPLogger)
	db.Connect()
	db.RegisterCallback()

	// tables := "basic_pricing"
	// migrations.GenerateModel(nil, db.Get("master"))
	// os.Exit(0)

	//redis
	redisDB := database.NewRedis(AppConfig, DBLogger)
	redisDB.Connect()
	redisDB.RegisterCallback()

	Helper := helpers.NewHelper(AppConfig, db, APPLogger, redisDB)
	app := handlers.NewHandlers(Helper)
	app.Run()
}
