// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc.  All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

syntax = "proto2";

package pb;

import "google/protobuf/descriptor.proto";

extend google.protobuf.FeatureSet {
  optional TestFeatures test = 9999;
}

message TestMessage {
  extend google.protobuf.FeatureSet {
    optional TestFeatures test_message = 9998;
  }
  message Nested {
    extend google.protobuf.FeatureSet {
      optional TestFeatures test_nested = 9997;
    }
  }
}

message TestFeatures {
  optional int32 int_file_feature = 1 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_FILE,
    edition_defaults = { edition: "2025", value: "5" },
    edition_defaults = { edition: "2023.1.2", value: "3" },
    edition_defaults = { edition: "2023", value: "1" },
    edition_defaults = { edition: "2023.1", value: "2" },
    edition_defaults = { edition: "2024", value: "4" }
  ];
  optional int32 int_extension_range_feature = 2 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_EXTENSION_RANGE,
    edition_defaults = { edition: "2023", value: "1" }
  ];
  optional int32 int_message_feature = 3 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_MESSAGE,
    edition_defaults = { edition: "2023", value: "1" }
  ];
  optional int32 int_field_feature = 4 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_FIELD,
    edition_defaults = { edition: "2023", value: "1" }
  ];
  optional int32 int_oneof_feature = 5 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_ONEOF,
    edition_defaults = { edition: "2023", value: "1" }
  ];
  optional int32 int_enum_feature = 6 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_ENUM,
    edition_defaults = { edition: "2023", value: "1" }
  ];
  optional int32 int_enum_entry_feature = 7 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_ENUM_ENTRY,
    edition_defaults = { edition: "2023", value: "1" }
  ];
  optional int32 int_service_feature = 8 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_SERVICE,
    edition_defaults = { edition: "2023", value: "1" }
  ];
  optional int32 int_method_feature = 9 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_METHOD,
    edition_defaults = { edition: "2023", value: "1" }
  ];
  optional int32 int_multiple_feature = 10 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_FILE,
    targets = TARGET_TYPE_FIELD,
    targets = TARGET_TYPE_MESSAGE,
    targets = TARGET_TYPE_ENUM,
    targets = TARGET_TYPE_ENUM_ENTRY,
    targets = TARGET_TYPE_SERVICE,
    targets = TARGET_TYPE_METHOD,
    targets = TARGET_TYPE_ONEOF,
    targets = TARGET_TYPE_EXTENSION_RANGE,
    edition_defaults = { edition: "2023", value: "1" }
  ];

  optional bool bool_field_feature = 11 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_FIELD,
    edition_defaults = { edition: "2023", value: "false" },
    edition_defaults = { edition: "2023.1", value: "true" }
  ];
  optional float float_field_feature = 12 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_FIELD,
    edition_defaults = { edition: "2023", value: "1.1" },
    edition_defaults = { edition: "2023.1", value: "1.2" }
  ];

  message MessageFeature {
    optional bool bool_field = 1;
    optional int32 int_field = 2;
    optional float float_field = 3;
    optional string string_field = 4;
  }
  optional MessageFeature message_field_feature = 13 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_FIELD,
    edition_defaults = { edition: "2023.1", value: "int_field: 2" },
    edition_defaults = { edition: "2024", value: "string_field: '2024'" },
    edition_defaults = {
      edition: "2023",
      value: "bool_field: true int_field: 1 float_field: 1.5 string_field: '2023'"
    },
    edition_defaults = {
      edition: "2025",
      value: "int_field: 4 string_field: '2025'"
    }
  ];

  enum EnumFeature {
    TEST_ENUM_FEATURE_UNKNOWN = 0;
    ENUM_VALUE1 = 1;
    ENUM_VALUE2 = 2;
    ENUM_VALUE3 = 3;
    ENUM_VALUE4 = 4;
    ENUM_VALUE5 = 5;
  }
  optional EnumFeature enum_field_feature = 14 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_FIELD,
    edition_defaults = { edition: "2023.10", value: "ENUM_VALUE3" },
    edition_defaults = { edition: "2023.9", value: "ENUM_VALUE2" },
    edition_defaults = { edition: "2025", value: "ENUM_VALUE5" },
    edition_defaults = { edition: "2023", value: "ENUM_VALUE1" },
    edition_defaults = { edition: "2024", value: "ENUM_VALUE4" }
  ];

  optional int32 int_source_feature = 15 [
    retention = RETENTION_SOURCE,
    targets = TARGET_TYPE_FILE,
    targets = TARGET_TYPE_FIELD,
    targets = TARGET_TYPE_MESSAGE,
    targets = TARGET_TYPE_ENUM,
    targets = TARGET_TYPE_ENUM_ENTRY,
    targets = TARGET_TYPE_SERVICE,
    targets = TARGET_TYPE_METHOD,
    targets = TARGET_TYPE_ONEOF,
    targets = TARGET_TYPE_EXTENSION_RANGE,
    edition_defaults = { edition: "2023", value: "1" }
  ];

  optional string string_source_feature = 16 [
    retention = RETENTION_SOURCE,
    targets = TARGET_TYPE_FILE,
    targets = TARGET_TYPE_FIELD,
    targets = TARGET_TYPE_MESSAGE,
    targets = TARGET_TYPE_ENUM,
    targets = TARGET_TYPE_ENUM_ENTRY,
    targets = TARGET_TYPE_SERVICE,
    targets = TARGET_TYPE_METHOD,
    targets = TARGET_TYPE_ONEOF,
    targets = TARGET_TYPE_EXTENSION_RANGE,
    edition_defaults = { edition: "2023", value: "'2023'" }
  ];
}
