// Copyright 2021 Lightbend Inc.

// All extension points for Akka Serverless

syntax = "proto3";

package akkaserverless;

option go_package = "github.com/lightbend/akkaserverless-go-sdk/akkaserverless;akkaserverless";
option java_multiple_files = true;
option java_package = "com.akkaserverless";

import "akkaserverless/component.proto";
import "akkaserverless/entity.proto";
import "akkaserverless/eventing.proto";
import "akkaserverless/jwt.proto";
import "akkaserverless/views.proto";
import "google/protobuf/descriptor.proto";

message FieldOptions {
  // Extension for specifying which field in a message is to be considered an
  // entity key, for the purposes of associating gRPC calls with entities and
  // sharding.
  bool entity_key = 1;
  // JWT claim and token configuration.
  JwtFieldOptions jwt = 2;
}

message FileOptions {
  // Event sourced entity configuration.
  EventSourcedEntity event_sourced_entity = 1;
  // Value entity configuration.
  ValueEntity value_entity = 2;
  // Replicated entity configuration.
  ReplicatedEntity replicated_entity = 3;
}

message MessageOptions {
  // JWT validation and signing configuration.
  JwtMessageOptions jwt = 1;
}

message MethodOptions {
  // Eventing configuration for a gRPC method.
  Eventing eventing = 1;
  // Views configuration for a gRPC method.
  View view = 2;
  // JWT validation and signing configuration.
  JwtMethodOptions jwt = 3;
  // Entity options
  EntityMethodOptions entity = 4;
}

message ServiceOptions {
  enum ServiceType {
    SERVICE_TYPE_UNSPECIFIED = 0; // Will be ignored for processing - same as omitting the service type
    SERVICE_TYPE_ACTION = 1;
    SERVICE_TYPE_ENTITY = 2;
    SERVICE_TYPE_VIEW = 3;
  }
  // This field is mandatory
  ServiceType type = 1;
  // A path to a component - required for SERVICE_TYPE_ENTITY types
  string component = 2;
}

message CodegenOptions {
  oneof codegen {
    EventSourcedEntityDef event_sourced_entity = 1;
    ValueEntityDef value_entity = 2;
    ReplicatedEntityDef replicated_entity = 3;
    ActionDef action = 4;
    ViewDef view = 5;
  }
}

extend google.protobuf.FieldOptions {
  FieldOptions field = 1080;
}

extend google.protobuf.FileOptions {
  FileOptions file = 1080;
}

extend google.protobuf.MethodOptions {
  MethodOptions method = 1080;
}

extend google.protobuf.MessageOptions {
  MessageOptions message = 1080;
}

extend google.protobuf.ServiceOptions {
  ServiceOptions service = 1080;
  CodegenOptions codegen = 1081;
}
