package main

import (
	"fmt"
	"log"

	"doormile/config"
	"doormile/db"
	"doormile/models"
	"doormile/utils"
)

func main() {
	cfg, err := config.LoadConfig()
	if err != nil {
		log.Fatal("Failed to load config:", err)
	}

	db.ConnectDB(cfg)

	passHash, _ := utils.HashPassword("admin")
	
	adminUser := models.AppUser{
		Authname:      "Super Admin",
		Email:         "admin@doormile.com",
		Contactno:     "1234567890",
		Password:      passHash,
		Roleid:        1,
		Status:        "Active",
		Applocationid: 1,
	}

	if err := db.DB.Create(&adminUser).Error; err != nil {
		log.Fatal("Failed to create admin user:", err)
	}

	fmt.Println("Successfully created admin user: admin@doormile.com / admin")
}
