// Protocol Buffers for Swift
//
// Copyright 2014 AlexeyXo.
// Copyright 2008 Google Inc.
//
// 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
//
//      http://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";
import "google/protobuf/descriptor.proto";

package google.protobuf;

enum AccessControl {
  InternalEntities = 0;
  PublicEntities = 1;
}

message LinkedObject {
  required string fieldName = 1;
  required string fromType = 2;
  required string propertyName = 3;
}

message SwiftFileOptions {
  optional string class_prefix = 1;
  optional AccessControl entities_access_control = 2 [default = PublicEntities];
  optional bool compile_for_framework = 3 [default = true];
  optional bool generate_struct = 4 [default = false];
  optional bool generate_realm_objects = 5 [default = false];
  optional bool generate_react = 6 [default = false];
}

message SwiftMessageOptions {
  optional bool generate_error_type = 1 [default = false];
  optional bool generate_realm_object = 2 [default = false];
  optional bool generate_react = 3 [default = false];
  optional string additional_class_name = 4;
  repeated LinkedObject linkedObjects = 5;
}

enum RealmOverrideRepeated {
  OVERRIDE = 0;
  APPEND = 1;
}
message SwiftFieldOptions {
  optional bool realm_indexed_propertie = 1 [default = false];
  optional bool realm_primary_key = 2 [default = false];
  optional RealmOverrideRepeated realm_override_propertie = 3 [default = OVERRIDE];
}

message SwiftEnumOptions {
  optional bool generate_error_type = 1 [default = false];
  optional bool generate_react = 2 [default = false];
  optional bool generate_realm_object = 3 [default = false];
}

extend google.protobuf.FileOptions {
  optional SwiftFileOptions swift_file_options = 5100987;
}

extend google.protobuf.FieldOptions {
  optional SwiftFieldOptions swift_field_options = 5100986;
}

extend google.protobuf.MessageOptions {
  optional SwiftMessageOptions swift_message_options = 5100985;
}

extend google.protobuf.EnumOptions {
  optional SwiftEnumOptions swift_enum_options = 5100984;
}

option (.google.protobuf.swift_file_options).compile_for_framework = false;
option (.google.protobuf.swift_file_options).entities_access_control = PublicEntities;
