{ pkgs, ... }@all: with all;
lib.mkIf (hyper.host != "NxACE")
{
  systemd.timers."health_reminder" = {
    enable = true;
    wantedBy = [ "timers.target" ];
    timerConfig = {
      OnBootSec = "30m";
      OnUnitActiveSec = "10m";
      Unit = "health_reminder.service";
    };
  };

  systemd.services."health_reminder" = let
      hm = pkgs.writers.writePython3Bin "health_reminder" {
        flakeIgnore = [ "E302" "E305" "E226" "E501" ];
      }  /*python*/ ''
        import random
        import re

        class Action:
            def __init__(self, action: str, likelihood: int, options: list[str] = None):
                self.action = action
                self.likelihood = likelihood
                self.options = options if options is not None else []

            def __str__(self):
                try:
                    choice = random.choice(self.options)
                except IndexError:
                    choice = ""

                action = re.sub("%o", choice, self.action)
                return action

        actions = [
            Action(action="look away for %o Seconds!", likelihood=30, options=["10", "15"]),
            Action(action="Posture Check!", likelihood=200),
            Action(action="Strech your upper body!", likelihood=20),
            Action(action="Strech your core!", likelihood=10),
            Action(action="Strech your legs!", likelihood=20),
            Action(action="Strech your arms/hands!", likelihood=10),
            Action(action="Make Tea!", likelihood=5),
            Action(action="说现在中文的时间！", likelihood=2),
        ]

        total_likelihood = sum(a.likelihood for a in actions)
        random_action = random.choices(actions, [a.likelihood for a in actions], k=1)[0]
        print(random_action)
      '';
    in {
      script = ''
        set -eu
        export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus"
        ${pkgs.libnotify}/bin/notify-send "$(${hm}/bin/health_reminder)"
      '';
      serviceConfig = {
        Type = "oneshot";
        User = hyper.user;
      };
    };
}
