package asset

import "github.com/break/junhong_cmp_fiber/internal/model"

// computeUsageSummary 汇总当前世代套餐的虚已用量和虚剩余量。
// 对每条记录调用 BuildTrafficMetrics() 获取虚流量字段，累加后计算剩余。
func computeUsageSummary(usages []*model.PackageUsage) (totalUsedMB float64, totalRemainingMB float64) {
	var totalVirtualTotal float64
	for _, u := range usages {
		m := u.BuildTrafficMetrics()
		totalUsedMB += m.VirtualUsedMB
		totalVirtualTotal += float64(m.VirtualTotalMB)
	}
	totalRemainingMB = totalVirtualTotal - totalUsedMB
	return
}
