# ------------------------------------------------------------
# PSUT IoT Engineering Studio · E04
# Defensive analysis of synthetic records only; no network I/O.
# ------------------------------------------------------------
"""Virtual pool of 12 addresses, 11 active lease records, five confirmed expired and four authorized waiting clients."""
import json

# Editable defensive setting (only the documented choices are permitted).
CHOICES = [0, 1, 2, 3, 4, 5]
DEFAULT = 3

def analyze(x):
    """Return independently interpretable defensive metrics."""
    if isinstance(x, bool) or x not in CHOICES:
        raise ValueError("Choose a documented defensive setting")
    return {
        'Free addresses': 1+x,
        'Waiting clients admitted': min(4,1+x),
        'Waiting clients deferred': 4-min(4,1+x),
        'Active leases after': 11-x+min(4,1+x)
    }

if __name__ == "__main__":
    for setting in CHOICES:
        print(json.dumps({"setting": setting, "metrics": analyze(setting)}))
