#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
"""Offline fictional light-sample flag: one intentional nested-branch bug.

Never connect this classroom code to a physical control or safety system.
The sample score is made up, and no personal information is collected.
"""

def flag(score: int, maintenance: bool) -> str:
    if score >= 80:
        if maintenance:
            return "HIGH"  # BUG: expected PENDING_RECHECK for this case.
        return "HIGH"
    if score >= 40:
        return "WATCH"
    return "OK"


if __name__ == "__main__":
    cases = [(90, False, "HIGH"), (90, True, "PENDING_RECHECK"), (55, False, "WATCH")]
    for score, maintenance, expected in cases:
        actual = flag(score, maintenance)
        print(f"score={score} maintenance={maintenance} actual={actual} expected={expected} match={actual == expected}")
