// LINT: ALLOW_GROUPS
syntax = "proto2";

package google.expr.proto2.test;

option go_package = "github.com/google/cel-go/test/proto2pb";

import "google/protobuf/any.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";

// This proto includes every type of field in both singular and repeated
// forms.
message TestAllTypes {
  message NestedMessage {
    // The field name "b" fails to compile in proto1 because it conflicts with
    // a local variable named "b" in one of the generated methods.
    // This file needs to compile in proto1 to test backwards-compatibility.
    optional int32 bb = 1;
  }

  enum NestedEnum {
    FOO = 0;
    BAR = 1;
    BAZ = 2;
  }

  // Singular
  optional int32 single_int32 = 1 [default = -32];
  optional int64 single_int64 = 2 [default = -64];
  optional uint32 single_uint32 = 3 [default = 32];
  optional uint64 single_uint64 = 4 [default = 64];
  optional sint32 single_sint32 = 5;
  optional sint64 single_sint64 = 6;
  optional fixed32 single_fixed32 = 7;
  optional fixed64 single_fixed64 = 8;
  optional sfixed32 single_sfixed32 = 9;
  optional sfixed64 single_sfixed64 = 10;
  optional float single_float = 11 [default = 3.0];
  optional double single_double = 12 [default = 6.4];
  optional bool single_bool = 13 [default = true];
  optional string single_string = 14 [default = "empty"];
  optional bytes single_bytes = 15 [default = "none"];
  optional NestedEnum standalone_enum = 22;
  optional group NestedGroup = 23 {
    optional int32 nested_id = 24;
    optional string nested_name = 25;
  }

  // Wellknown.
  optional google.protobuf.Any single_any = 100;
  optional google.protobuf.Duration single_duration = 101;
  optional google.protobuf.Timestamp single_timestamp = 102;
  optional google.protobuf.Struct single_struct = 103;
  optional google.protobuf.Value single_value = 104;
  optional google.protobuf.Int64Value single_int64_wrapper = 105;
  optional google.protobuf.Int32Value single_int32_wrapper = 106;
  optional google.protobuf.DoubleValue single_double_wrapper = 107;
  optional google.protobuf.FloatValue single_float_wrapper = 108;
  optional google.protobuf.UInt64Value single_uint64_wrapper = 109;
  optional google.protobuf.UInt32Value single_uint32_wrapper = 110;
  optional google.protobuf.StringValue single_string_wrapper = 111;
  optional google.protobuf.BoolValue single_bool_wrapper = 112;
  optional google.protobuf.BytesValue single_bytes_wrapper = 113;

  // Nested messages
  oneof nested_type {
    NestedMessage single_nested_message = 18;
    NestedEnum single_nested_enum = 21 [default = BAR];
  }

  // Repeated
  repeated int32 repeated_int32 = 31;
  repeated int64 repeated_int64 = 32;
  repeated uint32 repeated_uint32 = 33;
  repeated uint64 repeated_uint64 = 34;
  repeated sint32 repeated_sint32 = 35;
  repeated sint64 repeated_sint64 = 36;
  repeated fixed32 repeated_fixed32 = 37;
  repeated fixed64 repeated_fixed64 = 38;
  repeated sfixed32 repeated_sfixed32 = 39;
  repeated sfixed64 repeated_sfixed64 = 40;
  repeated float repeated_float = 41;
  repeated double repeated_double = 42;
  repeated bool repeated_bool = 43;
  repeated string repeated_string = 44;
  repeated bytes repeated_bytes = 45;

  repeated NestedMessage repeated_nested_message = 48;

  repeated NestedEnum repeated_nested_enum = 51;

  repeated string repeated_string_piece = 54 [ctype = STRING_PIECE];
  repeated string repeated_cord = 55 [ctype = CORD];

  repeated NestedMessage repeated_lazy_message = 57;

  // Map
  map<string, string> map_string_string = 58;
  map<int64, NestedTestAllTypes> map_int64_nested_type = 59;
}

// This proto includes a recursively nested message.
message NestedTestAllTypes {
  optional NestedTestAllTypes child = 1;
  optional TestAllTypes payload = 2;
}

// This proto is used to show how extensions are tracked as fields
// with fully qualified names.
message ExampleType {
  optional string name = 1;
  optional string foo_bar = 2;
  optional int64 in = 3;
  extensions 100 to max;
}

// Message scoped extensions.
message ExtendedExampleType {
  extend ExampleType {
    repeated string extended_examples = 103;
    optional GlobalEnum enum_ext = 104;
  }
}

// This proto tests that global enums are resolved correctly.
enum GlobalEnum {
  GOO = 0;
  GAR = 1;
  GAZ = 2;
}

