package main
import (
	"fmt"
	"doormile/config"
	"doormile/db"
	"doormile/models"
	"doormile/utils"
	"github.com/joho/godotenv"
)
func main() {
	godotenv.Load()
	cfg := config.Load()
	db.Connect(cfg)
	var auth models.DoormileAuth
	err := db.DB.Where("email = ?", "suriya@doormile.com").First(&auth).Error
	if err != nil {
		fmt.Printf("User not found: %v\n", err)
		return
	}
	fmt.Printf("Found in doormile_auth: ID=%d, Email=%s, Role=%s\n", auth.ID, auth.Email, auth.Role)
	
	isValid := utils.CheckPasswordHash("suriya@123", auth.PasswordHash)
	fmt.Printf("Password check for 'suriya@123': %v\n", isValid)

	var user models.AppUser
	err = db.DB.Where("email = ?", "suriya@doormile.com").First(&user).Error
	if err != nil {
		fmt.Printf("AppUser not found: %v\n", err)
		return
	}
	fmt.Printf("Found in appusers: ID=%d, Email=%s, RoleID=%d\n", user.Userid, user.Email, user.Roleid)
}
