"""bluesky-pds — pre-op seed hooks (Phase 1e HC3). The P4 marker is a deterministic atproto account
(recipe-aware data in the PDS sqlite under /pds, the backed-up volume) — see _p4.py. pre_restore
deletes the account so a successful restore is observable (non-vacuous)."""

import os
import sys

sys.path.insert(0, os.path.dirname(__file__))
import _p4  # noqa: E402


def pre_upgrade(ctx):
    _p4.create_account(ctx.domain)


def pre_backup(ctx):
    _p4.create_account(ctx.domain)


def pre_restore(ctx):
    _p4.delete_account(ctx.domain)
    assert not _p4.account_exists(ctx.domain), "marker account delete did not take (pre_restore)"
