syntax = "proto2";

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

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

message ConsumedToken {
    optional int64 place_id = 1;
    optional int64 token_id = 2;
    optional int32 count = 3;
}


message Initialized {
    repeated ProducedToken initial_marking = 1;
    optional SerializedData initial_state = 2;
}

message TransitionFired {
    optional int64 job_id = 1;
    optional int64 correlation_id = 2;
    optional int64 transition_id = 3;
    optional int64 time_started = 4;
    optional int64 time_completed = 5;
    repeated ConsumedToken consumed = 6;
    repeated ProducedToken produced = 7;
    optional SerializedData data = 8;
}

message FailureStrategy {
    enum StrategyType {
        BLOCK_TRANSITION = 0;
        BLOCK_ALL = 1;
        RETRY = 2;
    }

    optional StrategyType strategy_type = 1;
    optional int64 retry_delay = 2;
}

message TransitionFailed {
    optional int64 job_id = 1;
    optional int64 correlation_id = 2;
    optional int64 transition_id = 3;
    optional int64 time_started = 4;
    optional int64 time_failed = 5;
    optional SerializedData input_data = 6;
    optional string failure_reason = 7;
    optional FailureStrategy failure_strategy = 8;
    repeated ConsumedToken consumed = 9;
}