pw_protobuf: Add enum for pw::Status

Fix: b/201822235

Change-Id: Ia7ecd0dc3084a1be85f3271b80b4b2a091168593
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/63380
Commit-Queue: Jennifer Silva <jennifersilva@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
diff --git a/pw_protobuf/BUILD.gn b/pw_protobuf/BUILD.gn
index f5597f0..087dae3 100644
--- a/pw_protobuf/BUILD.gn
+++ b/pw_protobuf/BUILD.gn
@@ -151,7 +151,10 @@
 }
 
 pw_proto_library("common_protos") {
-  sources = [ "pw_protobuf_protos/common.proto" ]
+  sources = [
+    "pw_protobuf_protos/common.proto",
+    "pw_protobuf_protos/status.proto",
+  ]
 }
 
 pw_proto_library("codegen_test_protos") {
diff --git a/pw_protobuf/docs.rst b/pw_protobuf/docs.rst
index 0b3387c..462ef77 100644
--- a/pw_protobuf/docs.rst
+++ b/pw_protobuf/docs.rst
@@ -576,6 +576,33 @@
 
 .. include:: size_report/decoder_incremental
 
+==========================
+Available protobuf modules
+==========================
+There are a handful of messages ready to be used in Pigweed projects. These are
+located in ``pw_protobuf/pw_protobuf_protos``.
+
+common.proto
+============
+Contains Empty message proto used in many RPC calls.
+
+
+status.proto
+============
+Contains the enum for pw::Status.
+
+.. Note::
+ ``pw::protobuf::StatusCode`` values should not be used outside of a .proto
+ file. Instead, the StatusCodes should be converted to the Status type in the
+ language. In C++, this would be:
+
+  .. code-block:: c++
+
+    // Reading from a proto
+    pw::Status status = static_cast<pw::Status::Code>(proto.status_field));
+    // Writing to a proto
+    proto.status_field = static_cast<pw::protobuf::StatusCode>(status.code()));
+
 ========================================
 Comparison with other protobuf libraries
 ========================================
diff --git a/pw_protobuf/pw_protobuf_protos/status.proto b/pw_protobuf/pw_protobuf_protos/status.proto
new file mode 100644
index 0000000..d60b693
--- /dev/null
+++ b/pw_protobuf/pw_protobuf_protos/status.proto
@@ -0,0 +1,38 @@
+// Copyright 2021 The Pigweed Authors
+//
+// 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
+//
+//     https://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.
+
+syntax = "proto3";
+
+package pw.protobuf;
+
+// StatusCode must match pw::Status in pw_status.
+enum StatusCode {
+  OK = 0;
+  CANCELLED = 1;
+  UNKNOWN = 2;
+  INVALID_ARGUMENT = 3;
+  DEADLINE_EXCEEDED = 4;
+  NOT_FOUND = 5;
+  ALREADY_EXISTS = 6;
+  PERMISSION_DENIED = 7;
+  RESOURCE_EXHAUSTED = 8;
+  FAILED_PRECONDITION = 9;
+  ABORTED = 10;
+  OUT_OF_RANGE = 11;
+  UNIMPLEMENTED = 12;
+  INTERNAL = 13;
+  UNAVAILABLE = 14;
+  DATA_LOSS = 15;
+  UNAUTHENTICATED = 16;
+}
\ No newline at end of file