from styles.base import AlarmStyle


class SimpleStyle(AlarmStyle):
    """Press the button once to stop the alarm."""

    def update(self, now, is_pressed):
        # LED solid on so the button is findable in the dark.
        self.set_led(True)
        return not is_pressed  # first press -> False -> stop


if __name__ == "__main__":
    # Self-check: not pressed keeps ringing; a press stops it.
    style = SimpleStyle(lambda on: None)
    assert style.update(0.0, False) is True
    assert style.update(0.1, True) is False
    print("simple self-check ok")
