package router

import (
	"fonchain-fiee/pkg/middleware"
	"fonchain-fiee/pkg/service"
	"fonchain-fiee/pkg/service/bundle"
	serviceCast "fonchain-fiee/pkg/service/cast"

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

func AnalysisRouter(r *gin.RouterGroup) {
	// r.POST("analysis/trigger-ayrshare-metrics", serviceCast.TriggerAyrshareMetricsCollector)

	analysis := r.Group("analysis")
	analysis.Use(middleware.CheckWebLogin(service.AccountProvider))
	{
		analysis.POST("create", serviceCast.CreateWorkAnalysis)
		analysis.POST("update", serviceCast.UpdateWorkAnalysis)
		analysis.POST("update-status", serviceCast.UpdateWorkAnalysisStatus)
		analysis.POST("detail", serviceCast.GetWorkAnalysis)
		analysis.POST("latest", serviceCast.GetLatestWorkAnalysis)
		analysis.POST("list", serviceCast.ListWorkAnalysis)
		analysis.POST("delete", serviceCast.DeleteWorkAnalysis)
		analysis.POST("export-list", serviceCast.ListWorkAnalysisExport)              // 数据分析分析列表导出
		analysis.POST("export-single-list", serviceCast.ListWorkAnalysisSingleExport) // 数据分析分析单个列表导出
		analysis.POST("artist-data-list", serviceCast.ArtistDataList)                 // 艺人数据列表
		analysis.POST("media-data-list", serviceCast.MediaDataList)                   // 自媒体数据列表
		analysis.POST("data-overview", serviceCast.DataOverview)                      // 数据概览
		analysis.POST("artist-metrics", serviceCast.ArtistMetricsSeries)              // 艺人指标系列
		analysis.POST("artist-metrics-single", serviceCast.ArtistMetricsDailyWindow)  // 艺人指标日窗口
		analysis.POST("tobe-confirmed-list", serviceCast.TobeConfirmedList)           // 待确认数据列表
		analysis.POST("update-approval-id", serviceCast.UpdateWorkAnalysisApprovalID) // 更新作品分析审批ID

		analysis.POST("trigger-ayrshare-metrics", serviceCast.TriggerAyrshareMetricsCollector) // 手动触发 Ayrshare 指标采集任务

	}

	// 员工任务相关路由（需要App登录验证
	analysisAppRoute := r.Group("app/analysis")
	analysisAppRoute.Use(middleware.CheckLogin(service.AccountFieeProvider))
	{
		analysisAppRoute.POST("list", serviceCast.ListWorkAnalysis)                  // 作品列表
		analysisAppRoute.POST("detail", serviceCast.GetWorkAnalysis)                 // 作品分析详情
		analysisAppRoute.POST("update-status", serviceCast.UpdateWorkAnalysisStatus) // 用户确认
		analysisAppRoute.POST("check-balance", serviceCast.CheckBundleBalance)       // 检查套餐余量
		analysisAppRoute.POST("tobe-confirmed-list", serviceCast.TobeConfirmedList)  // 待确认数据列表
		analysisAppRoute.POST("work-analysis-confirm", bundle.WorkAnalysisConfirm)
	}
}
