 (def ^:const REST_PID "3141045")
 (def ^:const WARN_SEC (* 25 60)) ; 25 min
 (def ^:const REST_WARN_SEC (* 5 60)) ; 5 min
+(def ^:const RUNNING_KEY "toggl_running")
 
 
 (def ^:const MESSAGES ; {{{

    #"^(.+?).*(を)?(開始|始め|はじめ)"
    (matchfn [desc]
      (toggl/start-entry desc :pid (desc->pid desc))
      (->> MESSAGES :start-entry rand-nth (out "@" user " ")))
    #"^(再開|さいかい)"
    (matchfn []

(def hestia-schedule
  (js/schedules
    "0 /5 * * * * *"
    #(when (jb/get RUNNING_KEY)
       (when-let [{:keys [pid sec]} (toggl/get-running-entry)]
         (cond
           (and (= (str pid) REST_PID) (> sec REST_WARN_SEC))
           (->> MESSAGES :rest-warn rand-nth (out "@uochan "))

           (> sec WARN_SEC)
           (->> MESSAGES :warn rand-nth (out "@uochan ")))))
    ))
