import datetime as d
import os

D = d.date
F = [
    ("Sora API launch (changelog Oct 6 2025) -> API shutdown (deprecations page 2026-09-24)", (D(2026, 9, 24) - D(2025, 10, 6)).days),
    ("Sora API launch -> deprecation notice (2026-03-24)", (D(2026, 3, 24) - D(2025, 10, 6)).days),
    ("Sora API expansion (changelog Mar 12 2026) -> deprecation notice (2026-03-24)", (D(2026, 3, 24) - D(2026, 3, 12)).days),
    ("Deprecation notice -> API shutdown (the notice period)", (D(2026, 9, 24) - D(2026, 3, 24)).days),
    ("Disney agreement (press release Dec 11 2025) -> shutdown announcement (Mar 24 2026)", (D(2026, 3, 24) - D(2025, 12, 11)).days),
    ("OpenAI API shutdown (2026-09-24) -> Azure retirement of sora-2 2025-12-08 (2026-10-15): days AFTER", (D(2026, 10, 15) - D(2026, 9, 24)).days),
    ("Azure retirement of sora-2 2025-10-06 (2026-07-15) -> OpenAI shutdown of the same snapshot (2026-09-24): days EARLIER on Azure", (D(2026, 9, 24) - D(2026, 7, 15)).days),
    ("Azure date for sora-2 2025-12-08 moved 2026-09-15 -> 2026-10-15 (commit ca98eeda30, 2026-08-24)", (D(2026, 10, 15) - D(2026, 9, 15)).days),
    ("Remix endpoint 'deprecated in 6 months' from Mar 12 2026 -> about Sep 12 2026; days before the whole API's shutdown", (D(2026, 9, 24) - D(2026, 9, 12)).days),
    ("gpt-5.4-cyber notice (2026-09-11 -> Oct 1 2026)", (D(2026, 10, 1) - D(2026, 9, 11)).days),
    ("specialized-variant minimum (policy: at least 3 months) in days, Sep 11 -> Dec 11", (D(2026, 12, 11) - D(2026, 9, 11)).days),
]
R = [
    ("rows with no replacement: 6 of 145 (deprecations_c7555.out.txt)", round(100 * 6 / 145, 1)),
    ("announcements with no replacement anywhere in the table: 1 of 36", round(100 * 1 / 36, 1)),
    ("rows with >= 180 days' notice: 112 of 145", round(100 * 112 / 145, 1)),
    ("WSJ via TechCrunch: users fell from about 1,000,000 to under 500,000 (at least this %)", 50.0),
]
out = ["%-118s %s" % (w, v) for w, v in F] + [""] + ["%-118s %s%%" % (w, v) for w, v in R]
text = "\n".join(out) + "\n"
open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "figures_c7555.out.txt"), "w", encoding="utf-8", newline="\n").write(text)
print(text)
