// Copyright 2021 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.devtools.build.lib.buildtool.buildevent;

import com.google.devtools.build.lib.events.ExtendedEventHandler;

/**
 * This event is fired from {@link
 * com.google.devtools.build.lib.platform.SystemSuspensionModule#suspendCallback} to indicate that
 * the user either suspended the build with a signal or put their computer to sleep.
 */
public class SystemSuspensionEvent implements ExtendedEventHandler.Postable {

  /** The possible reasons a system could be suspended. */
  public enum Reason {
    SIGTSTP("Signal SIGTSTP"),
    SIGCONT("Signal SIGCONT"),
    SLEEP("Computer put to sleep"),
    WAKE("Computer woken up");

    private final String logString;

    Reason(String logString) {
      this.logString = logString;
    }

    public String logString() {
      return logString;
    }

    static Reason fromInt(int number) {
      switch (number) {
        case 0:
          return SIGTSTP;
        case 1:
          return SIGCONT;
        case 2:
          return SLEEP;
        case 3:
          return WAKE;
        default:
          throw new IllegalStateException("Unknown suspension reason: " + number);
      }
    }
  };

  /** These constants are mapped to enum in third_party/bazel/src/main/native/unix_jni.h. */
  private final Reason reason;

  public SystemSuspensionEvent(int reason) {
    this.reason = Reason.fromInt(reason);
  }

  public Reason getReason() {
    return reason;
  }

  public String logString() {
    return "SystemSuspensionEvent: " + reason.logString();
  }
}

@@ -1423,24 +1423,119 @@
 ing;%0A    %7D%0A%0A
+    /** These constants are mapped to enum in third_party/bazel/src/main/native/unix_jni.h. */%0A
     static R
@@ -1873,101 +1873,8 @@
 %7D;%0A%0A
-  /** These constants are mapped to enum in third_party/bazel/src/main/native/unix_jni.h. */%0A
   pr

Fix up documentation that didn't get moved correctly when cleaning up https://github.com/bazelbuild/bazel/commit/286fb80081db0af43b1f86292ce417c6541d4ad4