.PHONY: apply-migration build-fetch-openrouter check-fetch-openrouter ci-fetch-openrouter help-fetch-openrouter run-real-pipeline test-fetch-openrouter verify-phase1 verify-phase2 verify-phase3 verify-phase4 verify-phase5 verify-phase6 verify-pre-phase6

test-fetch-openrouter:
	bash $(CURDIR)/scripts/test.sh

build-fetch-openrouter: scripts/fetch_openrouter.go
	go build -o /dev/null ./scripts/fetch_openrouter.go

ci-fetch-openrouter: build-fetch-openrouter test-fetch-openrouter

check-fetch-openrouter: ci-fetch-openrouter
	test -x scripts/test.sh
	test -f scripts/fetch_openrouter.go
	test -f scripts/testdata/openrouter_models_sample.json

apply-migration:
	bash $(CURDIR)/scripts/apply_migration.sh

run-real-pipeline:
	bash $(CURDIR)/scripts/run_real_pipeline.sh

verify-phase1:
	bash $(CURDIR)/scripts/verify_phase1.sh

verify-phase2:
	bash $(CURDIR)/scripts/verify_phase2.sh

verify-phase3:
	bash $(CURDIR)/scripts/verify_phase3.sh

verify-phase4:
	bash $(CURDIR)/scripts/verify_phase4.sh

verify-phase5:
	bash $(CURDIR)/scripts/verify_phase5.sh

verify-phase6:
	bash $(CURDIR)/scripts/verify_phase6.sh

verify-pre-phase6:
	bash $(CURDIR)/scripts/verify_pre_phase6.sh

help-fetch-openrouter:
	@printf "%-29s %s\n" "fetch-openrouter Makefile 入口" ""
	@printf "%-29s %s\n" "make build-fetch-openrouter" "编译采集器（仅构建，无测试）"
	@printf "%-29s %s\n" "make test-fetch-openrouter" "执行单元测试（仅测试，无构建）"
	@printf "%-29s %s\n" "make ci-fetch-openrouter" "构建 + 测试（全链路）"
	@printf "%-29s %s\n" "make check-fetch-openrouter" "CI 检查：构建 + 测试 + 产物验证"
	@printf "%-29s %s\n" "make apply-migration" "对 llm_intelligence 应用 PostgreSQL migration"
	@printf "%-29s %s\n" "make run-real-pipeline" "要求 .env 中已有 OPENROUTER_API_KEY，执行真实采集 + 日报生成"
	@printf "%-29s %s\n" "make verify-phase1" "执行 Phase 1 门禁检查"
	@printf "%-29s %s\n" "make verify-phase2" "执行 Phase 2 门禁检查"
	@printf "%-29s %s\n" "make verify-phase3" "执行 Phase 3 门禁检查"
	@printf "%-29s %s\n" "make verify-phase4" "执行 Phase 4 门禁检查"
	@printf "%-29s %s\n" "make verify-phase5" "执行 Phase 5 门禁检查"
	@printf "%-29s %s\n" "make verify-phase6" "执行 Phase 6 综合验收检查"
	@printf "%-29s %s\n" "make verify-pre-phase6" "执行 Phase 1~5 总门禁，决定是否可进入 Phase 6"
	@printf "%-29s %s\n" "make help-fetch-openrouter" "显示本帮助信息"
