syntax = "proto2";

import "scalapb/scalapb.proto";
import "common.proto";

option java_package = "com.ing.baker.runtime.actor.process_index.protobuf";
option (scalapb.options) = {
    flat_package: true
};

// Events

message ActorCreated {
    optional string recipeId = 1;
    optional string processId = 2;
    optional int64 dateCreated = 3;
}

message ActorPassivated {
    optional string processId = 1;
}

message ActorActivated {
    optional string processId = 1;
}

message ActorDeleted {
    optional string processId = 1;
}


// Protocol

message ActorMetaData {
    optional string recipeId = 1;
    optional string processId = 2;
    optional int64 createdTime = 3;
    optional bool isDeleted = 4;
}

message GetIndex {

}

message GetShardIndex {
    optional string entityId = 1;
}

message Index {
    repeated ActorMetaData entries = 1;
}

message CreateProcess {
    optional string recipeId = 1;
    optional string processId = 2;
}

message ProcessEvent {
    optional string processId = 1;
    optional RuntimeEvent event = 2;
    optional string correlationId = 3;
    optional bool waitForRetries = 4;
    optional int64 timeout = 5;
}

message RetryBlockedInteraction {
    optional string processId = 1;
    optional string interactionName = 2;
}

message ResolveBlockedInteraction {
    optional string processId = 1;
    optional string interactionName = 2;
    optional RuntimeEvent event = 3;
}

message StopRetryingInteraction {
    optional string processId = 1;
    optional string interactionName = 2;
}

message ProcessEventResponse {
    optional string processId = 1;
    optional SerializedData sourceRef = 2;
}

message GetProcessState {
    optional string processId = 1;
}

message GetCompiledRecipe {
    optional string recipeId = 1;
}

message ReceivePeriodExpired {
    optional string processId = 1;
}

message InvalidEvent {
    optional string processId = 1;
    optional string reason = 2;
}

message ProcessDeleted {
    optional string processId = 1;
}

message NoSuchProcess {
    optional string processId = 1;
}

message ProcessAlreadyExists {
    optional string processId = 1;
}