package main

import (
	"fmt"
	"log"
	"verification-platform-backend/internal/database"
	"verification-platform-backend/internal/model"
)

func main() {
	database.Init()

	log.Println("=== 查看套餐数据 ===")

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

	for _, pkg := range packages {
		fmt.Printf("ID: %d, Name: '%s', Price: %.2f, Period: %s, Status: %s\n",
			pkg.ID, pkg.Name, pkg.Price, pkg.Period, pkg.Status)

		var permission model.PackagePermission
		if err := database.DB.Where("package_id = ?", pkg.ID).First(&permission).Error; err != nil {
			fmt.Printf("  权限: 未找到\n")
		} else {
			fmt.Printf("  权限: MaxApps=%d, MaxStorage=%d, MaxApiCalls=%d\n",
				permission.MaxApplications, permission.MaxStorage, permission.MaxApiCalls)
		}
	}
}
