"""Watch slot Redis snapshots — cleared when no active 5s monitoring remains."""

from __future__ import annotations

from server.infrastructure.redis.client import get_redis

REDIS_WATCH_LIVE_PREFIX = "watch:live:"
REDIS_WATCH_PROC_PREFIX = "watch:proc:"
REDIS_WATCH_LAST_PREFIX = "watch:last:"


async def clear_watch_redis_snapshot(server_id: int) -> None:
    """Remove 5s watch sliding window; Agent continues normal 60s heartbeat."""
    redis = get_redis()
    await redis.delete(
        f"{REDIS_WATCH_LIVE_PREFIX}{server_id}",
        f"{REDIS_WATCH_PROC_PREFIX}{server_id}",
        f"{REDIS_WATCH_LAST_PREFIX}{server_id}",
    )
