import os

DETAILS = [
    {
        "file": "details/cornell-mps-acct.html",
        "title": "康奈尔大学 | 管理学专业研究硕士（会计方向）（MPS in Management – Accounting Specialization · 10 个月 · STEM · Johnson · Ithaca）",
        "badge": "MPS-Acct",
        "en": "Master of Professional Studies (MPS) in Management – Accounting Specialization, Samuel Curtis Johnson Graduate School of Management",
        "dur": "10 months, full-time residential (Ithaca, NY) - 准备 CPA 考试",
        "stem": "Yes (DHS STEM-designated)",
        "ddl": "Fall（8 月）入学；具体轮次待 Johnson 系站确认",
        "lang": "TOEFL iBT / IELTS Academic / Duolingo（具体分数待 Johnson 系站确认；不接受 TOEFL MyBest Score）",
        "test": "GMAT/GRE required（录取分布非最低门槛）",
        "tui": "约 USD 70,000+/10-month（精确待 Johnson 系站确认）",
        "url": "https://www.johnson.cornell.edu/programs/specialized-masters/mps-in-management-accounting-specialization/",
        "degree_points": [
            "Cornell Johnson MPS in Management – Accounting Specialization 是 1-year STEM-designated 全日制项目，Ithaca 主校区",
            "目标：准备 CPA 考试（150 college credits 要求）；也可考 CMA / CIA",
            "面向 Cornell 本校 Dyson AEM / Nolan Hotel Admin / Business Minors + 外部学生（外部学生需先修 8 门课）",
            "18 credits 核心会计课 + 管理 core",
            "F-1 学生 STEM-designated 可享 36 个月 OPT"
        ],
        "curriculum_points": [
            "Core 会计 18 credits：NBA 5000 Intermediate Accounting / NACCT 5520 Advanced Accounting / NACCT 5521 Cost Accounting / NBA 5020 Managerial Accounting / NBA 5060 Financial Statement Analysis / NBA 5090 Advanced FSA",
            "Global & strategic perspective：国际会计准则、全球市场影响",
            "Professional certification：满足 CPA 教育要求（150 credits）",
            "具体课程清单待 Johnson 系站确认"
        ],
        "app_points": [
            "在线 Application",
            "Resume",
            "Essays",
            "本科成绩单",
            "推荐信",
            "GMAT/GRE required",
            "TOEFL/IELTS/Duolingo（国际生，2 年内成绩；不接受 TOEFL MyBest Score）"
        ],
        "prereq_points": [
            "外部学生最低先修：Economics, Statistics, Business/Management, Financial Accounting, Finance, Marketing, Business Law, Intermediate Accounting I（即 Financial Accounting III / Corporate Financial Reporting）",
            "本科需 120+ credits",
            "Cornell 本校 Dyson AEM / Nolan Hotel Admin / Business Minors 可直接申请"
        ],
        "cost_points": [
            "约 USD 70,000+/10-month（精确待 Johnson 系站确认）",
            "Scholarship 自动考虑"
        ],
        "note_points": [
            "与 MPS in Management（通用方向，已落 cornell-mps-mgmt）是同学位不同 specialization",
            "排除项：Cornell Johnson MBA / EMBA 不在本库",
            "录取分布，非最低门槛"
        ]
    },
    {
        "file": "details/unc-mac.html",
        "title": "北卡罗来纳大学教堂山分校 | 会计硕士（MAC · 10-12 个月 · On-Campus · Kenan-Flagler）",
        "badge": "MAC",
        "en": "Master of Accounting (MAC, On-Campus, Kenan-Flagler Business School)",
        "dur": "10-12 months, full-time residential (June start, 也有 early August accelerated option) - 48 credits",
        "stem": "待确认（UNC MAC 官方未明确标注 STEM，会计类通常非 STEM）",
        "ddl": "June 入学（每年 1 次）；Aug accelerated option 需 3 门先修课 B+",
        "lang": "TOEFL iBT / IELTS Academic（具体分数待 Kenan-Flagler 系站确认）",
        "test": "GRE/GMAT 政策待 Kenan-Flagler 系站确认（Holistic review）",
        "tui": "in-state $46,076 / out-of-state $67,413（学费 + fees，12-month on-campus）",
        "url": "https://www.kenan-flagler.unc.edu/programs/master-of-accounting/",
        "degree_points": [
            "UNC Kenan-Flagler MAC On-Campus 是 10-12 month full-time residential 项目，Chapel Hill",
            "48 credits，面向 non-accounting 本科背景（最多 12 学分以前会计课）",
            "June 入学（每年 1 次 Orientation & Leadership Immersion）；Early August accelerated option 需 3 门先修课 B+",
            "典型就业：Big 4 public accounting audit/tax",
            "排除项：UNC MAC Online（12-36 months 在职，7 年平均工作经验）不在本库"
        ],
        "curriculum_points": [
            "核心会计 + 数据 + 领导力模块",
            "Structured recruiting（Big 9 秋招）",
            "具体课程清单待 Kenan-Flagler 系站确认"
        ],
        "app_points": [
            "在线 Application",
            "Unofficial transcripts",
            "Resume",
            "Essays",
            "推荐信",
            "GRE/GMAT（政策待 Kenan-Flagler 系站确认）",
            "TOEFL/IELTS（国际生）"
        ],
        "prereq_points": [
            "Early August option 先修：Intro Financial Accounting / Intro Finance (Time Value of Money) / Spreadsheets-Excel，均需 B+ 以上（AACSB 认证院校）",
            "On-Campus 主 June option 无严格先修，但要求 non-accounting 背景（最多 12 学分以前会计课）"
        ],
        "cost_points": [
            "in-state $46,076 / out-of-state $67,413（学费 + fees，12-month）",
            "典型工作经验 0-5 年"
        ],
        "note_points": [
            "排除项：UNC MAC Online Traditional（12-36 months 在职）/ Online Advanced Standing（12-24 months 在职，会计本科）不在本库",
            "排除项：Kenan-Flagler MBA 不在本库",
            "录取分布，非最低门槛"
        ]
    },
    {
        "file": "details/uva-ms-commerce.html",
        "title": "弗吉尼亚大学 | 商学硕士（MS in Commerce · 10 个月 · 4 tracks · STEM · McIntire）",
        "badge": "MSC",
        "en": "Master of Science in Commerce (M.S. in Commerce, McIntire School of Commerce)",
        "dur": "10 months, full-time residential (Charlottesville, VA) - 40 credit hours",
        "stem": "Yes (DHS STEM-designated)",
        "ddl": "Fall 入学；5 轮申请（具体轮次待 McIntire 系站确认）",
        "lang": "TOEFL iBT / IELTS Academic（具体分数待 McIntire 系站确认）",
        "test": "GRE/GMAT 政策待 McIntire 系站确认（Holistic review）",
        "tui": "约 USD 70,000+/10-month（精确待 McIntire 系站确认）",
        "url": "https://www.commerce.virginia.edu/ms-commerce",
        "degree_points": [
            "UVA McIntire MS in Commerce 是 10-month full-time residential，Charlottesville 主校区",
            "40 credit hours，面向 liberal arts / STEM 本科背景（**商科本科不可申请**）",
            "毕业不超过 18 个月内",
            "4 个 track：Biotechnology / Business Analytics / Finance / Marketing & Management",
            "Spring semester 含 3-week Global Immersion Experience",
            "F-1 学生 STEM-designated 可享 36 个月 OPT"
        ],
        "curriculum_points": [
            "Fall 核心：finance, strategy, analytics, leadership 基础",
            "Track 课程（15 credits per track）",
            "Biotechnology track：Frontiers in Biotechnology I/II + Science electives（BME/CHE/PHS）",
            "Business Analytics track：data analytics + AI + predictive modeling",
            "Finance track：corporate finance / investments / valuation",
            "Marketing & Management track：marketing analytics / consumer engagement / org leadership"
        ],
        "app_points": [
            "在线 Application",
            "Resume",
            "Essays",
            "本科成绩单",
            "推荐信",
            "GRE/GMAT（政策待 McIntire 系站确认）",
            "TOEFL/IELTS（国际生）"
        ],
        "prereq_points": [
            "本科为 liberal arts 或 STEM 专业，**商科本科（BBA/Business Admin）不可申请**",
            "建议先修：定量课程（Pre-Calculus / Statistics）",
            "毕业不超过 18 个月内（面向 new grad）"
        ],
        "cost_points": [
            "约 USD 70,000+/10-month（精确待 McIntire 系站确认）",
            "Scholarship 自动考虑"
        ],
        "note_points": [
            "注意：UVA MS Finance 实际是 MS Commerce 的 Finance Track，**无独立 MS Finance 项目** → 不单独落库",
            "排除项：UVA AMP / VEO Systems Engineering（alternate-weekend on-Grounds / online distributed 在职）不在本库",
            "排除项：UVA MSBA (McIntire × Darden)（working professional format，需 2 年 post-bachelor 工作经验）不在本库",
            "录取分布，非最低门槛"
        ]
    },
    {
        "file": "details/nyu-msacc.html",
        "title": "纽约大学 | 会计学硕士（MS in Accounting · 1 年 · 30 学分 · CPA-ready · Stern · Greenwich Village）",
        "badge": "MSAcc",
        "en": "Master of Science in Accounting (MS in Accounting, Stern School of Business)",
        "dur": "1 year, full-time on-campus (Greenwich Village, NYC) - 30 credits",
        "stem": "待确认（会计类通常非 STEM，但 Stern MS Accounting 含 data analytics 方向待核）",
        "ddl": "Fall 入学；具体轮次待 Stern 系站确认",
        "lang": "TOEFL iBT / IELTS Academic（具体分数待 Stern 系站确认）",
        "test": "GRE/GMAT 政策待 Stern 系站确认（Holistic review）",
        "tui": "约 USD 80,000+/year（精确待 Stern 系站确认）",
        "url": "http://www.stern.nyu.edu/programs-admissions/masters-programs/ms-accounting",
        "degree_points": [
            "NYU Stern MS in Accounting 是 1-year full-time on-campus，Greenwich Village 校区",
            "30 credits，满足 NY State CPA licensure 教育要求（33 semester hours professional accounting + 36 semester hours general business）",
            "Licensure-qualifying program registered with NYSED",
            "BS/MS 项目是 Stern 本科直升（不收录）；外部直申 MS in Accounting 可落",
            "GradReports.com 2020 Best Master's in Accounting #1"
        ],
        "curriculum_points": [
            "Fall 15 credits：Financial Statement Analysis / Financial Reporting and Disclosure / Topics in Advanced Communication in Accounting / Professional Responsibility / Auditing",
            "Spring 15 credits：ACCT-GB 3304 Modeling Financial Statements / ACCT-GB 3315 Internal Controls & Accounting Information Systems (Data Analytics) / ACCT-GB 3330 Business Acquisitions, Deferred Taxes, Translations, and Derivatives",
            "选修：Advanced Managerial Accounting / Forensic Accounting and Financial Statement Fraud / Foundations of Corporate Finance"
        ],
        "app_points": [
            "在线 Application",
            "Resume",
            "Essays",
            "本科成绩单",
            "推荐信",
            "GRE/GMAT（政策待 Stern 系站确认）",
            "TOEFL/IELTS（国际生）"
        ],
        "prereq_points": [
            "满足 NY State CPA 教育路径要求（33 semester hours professional accounting + 36 semester hours general business）",
            "学术 advisors 协助 course distribution 满足各州 board 要求"
        ],
        "cost_points": [
            "约 USD 80,000+/year（精确待 Stern 系站确认）",
            "Financial Aid / Scholarships / Loans / Graduate Fellowships"
        ],
        "note_points": [
            "排除项：NYU BS/MS in Accounting（Stern 本科直升，加速 3.5-4 年）不在本库",
            "排除项：Stern MBA / EMBA 不在本库",
            "录取分布，非最低门槛"
        ]
    },
    {
        "file": "details/jhu-msf.html",
        "title": "约翰霍普金斯大学 | 金融学硕士（MS in Finance · 9/12/15 个月 · STEM · CFA-aligned · Carey）",
        "badge": "MSF",
        "en": "Master of Science in Finance (MS in Finance, Carey Business School) - 9/12/15-month full-time formats",
        "dur": "9 months (30 credits, 2 semesters) / 12 months (36 credits, 3 semesters) / 15 months (36 credits, 4 semesters)",
        "stem": "Yes (DHS STEM-designated, all 3 formats)",
        "ddl": "Fall Term 入学；具体轮次待 Carey 系站确认",
        "lang": "TOEFL iBT / IELTS Academic（具体分数待 Carey 系站确认）",
        "test": "GRE/GMAT 政策待 Carey 系站确认（Holistic review）",
        "tui": "9-month $78,500 / 12-month $94,500 / 15-month $99,750（学费 + fees）",
        "url": "https://carey.jhu.edu/programs/master-science/finance",
        "degree_points": [
            "JHU Carey MS in Finance 是 STEM-designated full-time in-person，Baltimore + Washington DC 两校区",
            "3 个版本：9-month (30 credits, 2 semesters) / 12-month (36 credits, 3 semesters) / 15-month (36 credits, 4 semesters, DC only)",
            "15-month 含 Financial Econometrics concentration；9-month 不含 concentration",
            "CFA Institute Candidate Body of Knowledge-aligned，准备 CFA 考试",
            "F-1 学生 STEM-designated 可享 36 个月 OPT"
        ],
        "curriculum_points": [
            "核心：financial instruments, portfolio allocation, risk management, corporate finance, company valuation, corporate governance",
            "Quantitative：computational, statistical, econometric techniques",
            "Hands-on：analytics, coding, visualization, real capital exposure, competitions, industry engagement",
            "具体课程清单待 Carey 系站确认"
        ],
        "app_points": [
            "在线 Application",
            "Resume",
            "Essays",
            "本科成绩单",
            "推荐信",
            "GRE/GMAT（政策待 Carey 系站确认）",
            "TOEFL/IELTS（国际生）"
        ],
        "prereq_points": [
            "面向 early-career / new grad",
            "Quantitative background 加分",
            "Course waivers are not granted"
        ],
        "cost_points": [
            "9-month $78,500 / 12-month $94,500 / 15-month $99,750",
            "All students considered for scholarships"
        ],
        "note_points": [
            "注意：JHU Carey 也有 Part-time 版本 → 排除，仅落 full-time in-person",
            "排除项：Carey MBA / EMBA 不在本库",
            "排除项：JHU AAP MS Biotechnology（有在线模式）不在本库",
            "录取分布，非最低门槛"
        ]
    }
]

TEMPLATE = """<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>{title}</title>
<style>
body{{font-family:-apple-system,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;max-width:960px;margin:0 auto;padding:24px;color:#222;line-height:1.65;background:#fafafa}}
h1{{font-size:22px;border-bottom:3px solid #1a3a6c;padding-bottom:10px}}
h2{{font-size:16px;color:#1a3a6c;margin-top:28px;background:#eef2f8;padding:8px 12px;border-left:4px solid #1a3a6c}}
ul{{margin:8px 0;padding-left:22px}}
li{{margin:4px 0}}
.meta{{background:#fff;border:1px solid #dde;border-radius:6px;padding:12px 16px;margin:14px 0}}
.meta b{{color:#1a3a6c}}
a{{color:#1a6fc4}}
.badge{{display:inline-block;background:#1a3a6c;color:#fff;padding:2px 8px;border-radius:10px;font-size:12px;margin-left:8px}}
.warn{{background:#fff8e1;border-left:4px solid #f0a020;padding:8px 12px;margin:12px 0}}
</style>
</head>
<body>
<h1>{school_label} {short_title} <span class="badge">{badge}</span></h1>
<div class="meta">
<b>英文名：</b>{en}<br>
<b>学制：</b>{dur}<br>
<b>STEM：</b>{stem}<br>
<b>申请截止：</b>{ddl}<br>
<b>语言要求：</b>{lang}<br>
<b>标化：</b>{test}<br>
<b>学费：</b>{tui}<br>
<b>官网：</b><a href="{url}" target="_blank">{url}</a>
</div>
<h2>学位与学制</h2><ul>{degree_html}</ul>
<h2>核心课程与学分</h2><ul>{curriculum_html}</ul>
<h2>申请要求</h2><ul>{app_html}</ul>
<h2>先修与背景</h2><ul>{prereq_html}</ul>
<h2>费用与资助</h2><ul>{cost_html}</ul>
<h2>录取提示</h2><ul>{note_html}</ul>
<div class="warn">说明：本页为半核验页，学位/学制/截止/语言方向/先修已从学校官网核实；具体课程清单、精确学费、奖学金细节等待系站恢复后补全。录取分布，非最低门槛。</div>
</body>
</html>
"""

SCHOOL_MAP = {
    "cornell-mps-acct": ("康奈尔大学 ·", "管理学专业研究硕士（会计方向）（MPS in Management – Accounting Specialization · 10 个月 · STEM · Johnson · Ithaca）"),
    "unc-mac": ("北卡罗来纳大学教堂山分校 ·", "会计硕士（MAC · 10-12 个月 · On-Campus · Kenan-Flagler）"),
    "uva-ms-commerce": ("弗吉尼亚大学 ·", "商学硕士（MS in Commerce · 10 个月 · 4 tracks · STEM · McIntire）"),
    "nyu-msacc": ("纽约大学 ·", "会计学硕士（MS in Accounting · 1 年 · 30 学分 · CPA-ready · Stern · Greenwich Village）"),
    "jhu-msf": ("约翰霍普金斯大学 ·", "金融学硕士（MS in Finance · 9/12/15 个月 · STEM · CFA-aligned · Carey）"),
}

for d in DETAILS:
    base = os.path.basename(d["file"]).replace(".html", "")
    school_label, short_title = SCHOOL_MAP[base]
    html = TEMPLATE.format(
        title=d["title"],
        school_label=school_label,
        short_title=short_title,
        badge=d["badge"],
        en=d["en"],
        dur=d["dur"],
        stem=d["stem"],
        ddl=d["ddl"],
        lang=d["lang"],
        test=d["test"],
        tui=d["tui"],
        url=d["url"],
        degree_html="".join(f"<li>{x}</li>" for x in d["degree_points"]),
        curriculum_html="".join(f"<li>{x}</li>" for x in d["curriculum_points"]),
        app_html="".join(f"<li>{x}</li>" for x in d["app_points"]),
        prereq_html="".join(f"<li>{x}</li>" for x in d["prereq_points"]),
        cost_html="".join(f"<li>{x}</li>" for x in d["cost_points"]),
        note_html="".join(f"<li>{x}</li>" for x in d["note_points"]),
    )
    open(d["file"], "w", encoding="utf-8").write(html)
    print(f"[OK] wrote {d['file']} ({len(html)} chars)")
