// Copyright 2021 Google LLC
//
// 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 = "proto2";
package testdata;
option go_package = "cloud.google.com/go/bigquery/storage/managedwriter/testdata";
import "google/protobuf/wrappers.proto";

enum TestEnum {
  TestEnum0 = 0;
  TestEnum1 = 1;
}

message AllSupportedTypes {
  optional int32 int32_value = 1;
  optional int64 int64_value = 2;
  optional uint32 uint32_value = 3;
  optional uint64 uint64_value = 4;
  optional float float_value = 5;
  optional double double_value = 6;
  optional bool bool_value = 7;
  optional TestEnum enum_value = 8;
  required string string_value = 9;
  optional fixed64 fixed64_value = 10;
}

message WithWellKnownTypes {
  optional int64 int64_value = 1; 
  optional .google.protobuf.Int64Value wrapped_int64 = 2;
  repeated string string_value = 3;
  repeated .google.protobuf.StringValue wrapped_string = 4;
}

message InnerType {
  repeated string value = 1;
}

message NestedType {
  repeated InnerType inner_type = 1;
}

// This representation allows sending a Range<TIMESTAMP> value.
message RangeTypeTimestamp {
  optional int64 start = 1;
  optional int64 end = 2;
}

message ComplexType {
  repeated NestedType nested_repeated_type = 1;
  optional InnerType inner_type = 2;
  optional RangeTypeTimestamp range_type = 3;
  optional string json_type = 4;
}

message ContainsRecursive {
  optional RecursiveType field = 1;
}

message RecursiveType {
  optional ContainsRecursive field = 2;
}

message RecursiveTypeTopMessage {
  optional RecursiveTypeTopMessage field = 2;
}

message WithOneOf {
  optional int32 int32_value = 1;
  oneof oneof_value {
    string string_value = 2;
    double double_value = 3;
  }
}

message DefaultValues {
  optional string id = 1;
  optional string strcol = 2;
  optional string strcol_withdef = 3;
  optional int64 intcol = 4;
  optional int64 intcol_withdef = 5;
  optional string otherstr = 6;
  optional string otherstr_default = 7;
}

message DefaultValuesPartialSchema {
  optional string id = 1;
  optional string strcol = 2;
  optional string strcol_withdef = 3;
  optional int64 intcol = 4;
  optional int64 intcol_withdef = 5;
}