// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc.  All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

// This file is mostly equivalent to map_unittest.proto, but imports
// unittest_proto3.proto instead of unittest.proto, so that it only
// uses proto3 messages. This makes it suitable for testing
// implementations which only support proto3.
// The TestRequiredMessageMap message has been removed as there are no
// required fields in proto3.
syntax = "proto3";

package protobuf_unittest3;

import "csharp/protos/unittest_proto3.proto";

option csharp_namespace = "Google.Protobuf.TestProtos";

// Tests maps.
message TestMap {
  map<int32, int32> map_int32_int32 = 1;
  map<int64, int64> map_int64_int64 = 2;
  map<uint32, uint32> map_uint32_uint32 = 3;
  map<uint64, uint64> map_uint64_uint64 = 4;
  map<sint32, sint32> map_sint32_sint32 = 5;
  map<sint64, sint64> map_sint64_sint64 = 6;
  map<fixed32, fixed32> map_fixed32_fixed32 = 7;
  map<fixed64, fixed64> map_fixed64_fixed64 = 8;
  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
  map<int32, float> map_int32_float = 11;
  map<int32, double> map_int32_double = 12;
  map<bool, bool> map_bool_bool = 13;
  map<string, string> map_string_string = 14;
  map<int32, bytes> map_int32_bytes = 15;
  map<int32, MapEnum> map_int32_enum = 16;
  map<int32, ForeignMessage> map_int32_foreign_message = 17;
}

message TestMapSubmessage {
  TestMap test_map = 1;
}

message TestMessageMap {
  map<int32, TestAllTypes> map_int32_message = 1;
}

// Two map fields share the same entry default instance.
message TestSameTypeMap {
  map<int32, int32> map1 = 1;
  map<int32, int32> map2 = 2;
}

enum MapEnum {
  MAP_ENUM_FOO = 0;
  MAP_ENUM_BAR = 1;
  MAP_ENUM_BAZ = 2;
}

message TestArenaMap {
  map<int32, int32> map_int32_int32 = 1;
  map<int64, int64> map_int64_int64 = 2;
  map<uint32, uint32> map_uint32_uint32 = 3;
  map<uint64, uint64> map_uint64_uint64 = 4;
  map<sint32, sint32> map_sint32_sint32 = 5;
  map<sint64, sint64> map_sint64_sint64 = 6;
  map<fixed32, fixed32> map_fixed32_fixed32 = 7;
  map<fixed64, fixed64> map_fixed64_fixed64 = 8;
  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
  map<int32, float> map_int32_float = 11;
  map<int32, double> map_int32_double = 12;
  map<bool, bool> map_bool_bool = 13;
  map<int32, MapEnum> map_int32_enum = 14;
  map<int32, ForeignMessage> map_int32_foreign_message = 15;
}

// Previously, message containing enum called Type cannot be used as value of
// map field.
message MessageContainingEnumCalledType {
  enum Type {
    TYPE_FOO = 0;
  }
  map<int32, MessageContainingEnumCalledType> type = 1;
}

// Previously, message cannot contain map field called "entry".
message MessageContainingMapCalledEntry {
  map<int32, int32> entry = 1;
}
