from __future__ import annotations

import shutil
from pathlib import Path


PROJECT_DIR = Path(__file__).resolve().parent.parent
SETTINGS_DIR = PROJECT_DIR / "settings"

RUNTIME_FILES = [
    SETTINGS_DIR / "auth_settings.json",
    SETTINGS_DIR / "download_tech_pack_settings.json",
    SETTINGS_DIR / "ui_state.json",
]


def main() -> int:
    removed: list[Path] = []
    for path in RUNTIME_FILES:
        if path.exists():
            path.unlink()
            removed.append(path)

    local_cache_dir = Path(r"D:\Hermes\local\data\sample_cover_page_assets")
    if local_cache_dir.exists():
        shutil.rmtree(local_cache_dir, ignore_errors=True)
        removed.append(local_cache_dir)

    print("Local runtime state reset completed.")
    for path in removed:
        print(f"- Removed {path}")
    if not removed:
        print("- Nothing needed to be removed.")
    print("- Run scripts\\bootstrap_dev_machine.bat to recreate clean local settings.")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
