// Syntax comment...
syntax = "proto2"; // Syntax trailer.

// And now the package declaration
package foo.bar;

import "desc_test_options.proto";

import public "google/protobuf/empty.proto";

// option comments FTW!!!
option go_package = "github.com/jhump/protoreflect/internal/testprotos";

message AnEmptyMessage {
}

// We need a request for our RPC service below.
message Request {
   option deprecated = true; // deprecated!

   // lead mfubar
   option (testprotos.mfubar) = true; // trailing mfubar

   // A field comment
   repeated int32 ids = 1 [
      json_name = "|foo|",
      packed = true,
      (testprotos.ffubar) = "abc",
      (testprotos.ffubarb) = "xyz"
   ]; // field trailer #1...

   // label comment
   optional string name = 2 [default = "fubar"];

   // Group comment with emoji 😀 😍 👻 ❤ 💯 💥 🐶 🦂 🥑 🍻 🌍 🚕 🪐
   optional group Extras = 3 {
      // trailer for Extras

      option no_standard_descriptor_accessor = false;

      // this is a custom option
      option (testprotos.mfubar) = false;

      optional double dbl = 1;

      optional float flt = 2;

      // Leading comment...
      optional string str = 3; // Trailing comment...
   }

   // can be this or that
   oneof abc {
      // trailer for oneof abc

      string this = 4;

      int32 that = 5;
   }

   // can be these or those
   oneof xyz {
      // whoops?
      option (testprotos.oofubar) = "whoops, this has invalid UTF8! \274\377";

      string these = 6;

      int32 those = 7;
   }

   // map field
   map<string, string> things = 8;

   enum MarioCharacters {
      // trailer for enum

      // allow_alias comments!
      option allow_alias = true;

      option (testprotos.efubar) = 123;

      option (testprotos.efubars) = -321;

      SNIFIT = -101;

      MARIO = 1 [
         (testprotos.evfubar) = 278,
         (testprotos.evfubars) = -314
      ];

      LUIGI = 2 [
         (testprotos.evfubaru) = 200,
         (testprotos.evfubaruf) = 100
      ];

      PEACH = 3;

      BOWSER = 4;

      WARIO = 5;

      WALUIGI = 6;

      HEY_HO = 7;

      SHY_GUY = 7 [(testprotos.evfubarsf) = 10101];

      KAMEK = 8;

      MAGIKOOPA = 8;
   }

   extensions 100 to 200;

   extensions 201 to 250 [
      (testprotos.exfubar) = "splat!",
      (testprotos.exfubarb) = "\000\001\002\003\004\005\006\007"
   ];

   reserved 10 to 20, 30 to 50;

   reserved "bar", "baz", "foo";
}

// Service comment
service RpcService {
   // service trailer
   // that spans multiple lines

   option deprecated = false; // DEPRECATED!

   // option that sets field
   option (testprotos.sfubar) = { id: 100, name: "bob" };

   option (testprotos.sfubare) = VALUE;

   // Method comment
   rpc StreamingRpc ( stream Request ) returns ( Request ); // compact method trailer

   rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) {
      // trailer for method

      // this RPC is deprecated!
      option deprecated = true;

      option (testprotos.mtfubar) = 12.340000;

      option (testprotos.mtfubard) = 123.456000;
   }
}

extend Request {
   // trailer for extend block

   // comment for guid1
   optional uint64 guid1 = 123;

   // ... and a comment for guid2
   optional uint64 guid2 = 124;
}
