package middleware

import (
	"metazone.cc/metalab/internal/config"

	"github.com/gin-gonic/gin"
)

// InjectSiteInfo 注入站点展示信息到请求上下文（供 BuildPageData 使用）
// 应用于引擎级全局中间件，确保所有 SSR 页面都能读取 Framework/CopyrightStart/IsMaintenance
func InjectSiteInfo(siteSettings *config.SiteSettings) gin.HandlerFunc {
	return func(c *gin.Context) {
		info := siteSettings.SiteInfo()
		c.Set("site_framework", info.Framework)
		c.Set("site_copyright_start", info.CopyrightStart)
		c.Set("is_maintenance", siteSettings.IsMaintenanceEnabled())
		c.Next()
	}
}
