"""PPT skill 的总院品牌候选与别名路由回归测试。"""
import json
from pathlib import Path
import unittest


ROOT = Path(__file__).resolve().parents[1]


class TestPptSkillBrandPolicy(unittest.TestCase):
    def test_zongyuan_red_is_candidate_with_alias_direct_route(self):
        skill = (ROOT / "skills" / "ppt" / "SKILL.md").read_text(encoding="utf-8")
        strategist = (
            ROOT / "skills" / "ppt" / "references" / "strategist.md"
        ).read_text(encoding="utf-8")

        self.assertIn("候选硬门", skill)
        self.assertIn("候选列表中**必须包含**", skill)
        self.assertIn("用户未说明所属机构", skill)
        self.assertIn("用户明确说明 PPT 属于其他机构 / 品牌", skill)
        self.assertIn("总院模板别名直接归一", skill)
        self.assertIn("建材集团模板", skill)
        self.assertIn("机构词", skill)
        self.assertIn("中国建材风", skill)
        self.assertIn("候选硬门 + 别名直达", strategist)
        self.assertIn("用户已明确选中 `zongyuan_red`", strategist)
        self.assertNotIn("唯一默认入口", skill)
        self.assertNotIn("business-red", skill)
        self.assertNotIn("business-red", strategist)
        self.assertFalse(
            (ROOT / "skills" / "ppt" / "templates" / "brands" / "business-red").exists()
        )
        brands_index = json.loads(
            (
                ROOT
                / "skills"
                / "ppt"
                / "templates"
                / "brands"
                / "brands_index.json"
            ).read_text(encoding="utf-8")
        )
        self.assertNotIn("business-red", brands_index)


if __name__ == "__main__":
    unittest.main()
