package main

import (
	"fmt"
	"log"

	"verification-platform-backend/internal/database"
	"verification-platform-backend/internal/model"
)

func main() {
	database.Init()

	var allDynamicCodes []model.DynamicCode
	if err := database.DB.Unscoped().Find(&allDynamicCodes).Error; err != nil {
		log.Printf("查询失败: %v", err)
		return
	}

	log.Println("=== 所有动态代码（包括已删除） ===")
	for _, dc := range allDynamicCodes {
		deletedAt := ""
		if dc.DeletedAt.Valid {
			deletedAt = dc.DeletedAt.Time.Format("2006-01-02 15:04:05")
		}
		fmt.Printf("ID: %d, Name: %s, Key: %s, DeletedAt: %s\n", dc.ID, dc.Name, dc.Key, deletedAt)
	}

	var activeDynamicCodes []model.DynamicCode
	if err := database.DB.Find(&activeDynamicCodes).Error; err != nil {
		log.Printf("查询失败: %v", err)
		return
	}

	log.Println("\n=== 未删除的动态代码 ===")
	for _, dc := range activeDynamicCodes {
		fmt.Printf("ID: %d, Name: %s, Key: %s\n", dc.ID, dc.Name, dc.Key)
	}
}
