syntax = "proto3";

package org.kie.kogito.serialization.process.protobuf;

import "org/kie/kogito/serialization/process/protobuf/kogito_types.proto";
import "google/protobuf/any.proto";

option java_outer_classname = "KogitoNodeInstanceContentsProtobuf";

message RuleSetNodeInstanceContent {
    repeated string timer_instance_id = 1;
    optional string rule_flow_group = 2;
    map<string, string> timer_instance_reference = 3;
}

message WorkItemNodeInstanceContent {
    string work_item_id = 1;
    repeated string timer_instance_id = 2;
    optional string error_handling_process_instance_id = 3;

    // work item data
    int32 state = 4;
    repeated Variable variable = 5;
    repeated Variable result = 6;
    optional string phase_id = 7;
    optional string phase_status = 8;
    optional string name = 9;
    optional int64 start_date = 10;
    optional int64 complete_date = 11;
    optional google.protobuf.Any work_item_data = 12;
    map<string, string> timer_instance_reference = 13;
}

message LambdaSubProcessNodeInstanceContent {
    optional string process_instance_id = 1;
    repeated string timer_instance_id = 2;
    map<string, string> timer_instance_reference = 3;
}

message SubProcessNodeInstanceContent {
    optional string process_instance_id = 1;
    repeated string timer_instance_id = 2;
    map<string, string> timer_instance_reference = 3;
}

message MilestoneNodeInstanceContent {
    repeated string timer_instance_id = 1;
    map<string, string> timer_instance_reference = 2;
}

message EventNodeInstanceContent {
}

message TimerNodeInstanceContent {
   optional string timer_id = 1;
}

message JoinNodeInstanceContent {
    repeated JoinTrigger trigger = 1;
    message JoinTrigger {
        optional int64 node_id = 1;
        optional int32 counter = 2;
    }
}

message StateNodeInstanceContent {
    repeated string timer_instance_id = 1;
    map<string, string> timer_instance_reference = 2;
}

message CompositeContextNodeInstanceContent {
    repeated string timer_instance_id = 1;
    WorkflowContext context = 2;
    map<string, string> timer_instance_reference = 3;
}

message DynamicNodeInstanceContent {
    repeated string timer_instance_id = 1;
    WorkflowContext context = 2;
    map<string, string> timer_instance_reference = 3;
}

message EventSubProcessNodeInstanceContent {
    repeated string timer_instance_id = 1;
    WorkflowContext context = 2;
    map<string, string> timer_instance_reference = 3;
}

message ForEachNodeInstanceContent {
    repeated string timer_instance_id = 1;
    WorkflowContext context = 2;
    int32 totalInstances = 3;
    int32 executedInstances = 4;
    bool hasAsyncInstances = 5;
    map<string, string> timer_instance_reference = 6;
}

message AsyncEventNodeInstanceContent {
    string job_id = 1;
}