syntax = "proto3";

package coresdk.workflow_completion;
option ruby_package = "Temporalio::Internal::Bridge::Api::WorkflowCompletion";

import "temporal/api/failure/v1/message.proto";
import "temporal/api/enums/v1/failed_cause.proto";
import "temporal/api/enums/v1/workflow.proto";
import "temporal/sdk/core/common/common.proto";
import "temporal/sdk/core/workflow_commands/workflow_commands.proto";

// Result of a single workflow activation, reported from lang to core
message WorkflowActivationCompletion {
    // The run id from the workflow activation you are completing
    string run_id = 1;
    oneof status {
        Success successful = 2;
        Failure failed = 3;
    }
}

// Successful workflow activation with a list of commands generated by the workflow execution
message Success {
    // A list of commands to send back to the temporal server
    repeated workflow_commands.WorkflowCommand commands = 1;
    // Any internal flags which the lang SDK used in the processing of this activation
    repeated uint32 used_internal_flags = 6;
    // The versioning behavior this workflow is currently using
    temporal.api.enums.v1.VersioningBehavior versioning_behavior = 7;
}

// Failure to activate or execute a workflow
message Failure {
    temporal.api.failure.v1.Failure failure = 1;
    // Forces overriding the WFT failure cause
    temporal.api.enums.v1.WorkflowTaskFailedCause force_cause = 2;
}

