syntax = "proto2";

package pb;

import "google/protobuf/descriptor.proto";

option java_package = "com.google.protobuf";
option java_outer_classname = "JavaFeaturesProto";

extend google.protobuf.FeatureSet {
  optional JavaMutableFeatures java_mutable = 9989;
}

message JavaMutableFeatures {
  message NestInFileClassFeature {
    enum NestInFileClass {
      // Invalid default, which should never be used.
      NEST_IN_FILE_CLASS_UNKNOWN = 0;
      // Do not nest the generated class in the file class.
      NO = 1;
      // Nest the generated class in the file class.
      YES = 2;
      // Fall back to the `java_multiple_files` and
      // `java_multiple_files_mutable_package` options. Users won't be able to
      // set this option.
      LEGACY = 3 [feature_support = {
        edition_introduced: EDITION_2024
        edition_removed: EDITION_2024
      }];
    }
    reserved 1 to max;
  }

  // Whether to nest the generated class in the generated file class for
  // Java Proto2 Mutable API. This is only applicable to *top-level* messages,
  // enums, and services.
  optional NestInFileClassFeature.NestInFileClass nest_in_file_class = 6 [
    retention = RETENTION_RUNTIME,
    targets = TARGET_TYPE_MESSAGE,
    targets = TARGET_TYPE_ENUM,
    targets = TARGET_TYPE_SERVICE,
    feature_support = {
      edition_introduced: EDITION_2024,
    },
    edition_defaults = { edition: EDITION_LEGACY, value: "LEGACY" },
    edition_defaults = { edition: EDITION_2024, value: "NO" }
  ];
}
