// The MIT License
//
// Copyright (c) 2020 Temporal Technologies Inc.  All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

syntax = "proto3";

package temporal.api.enums.v1;

option go_package = "go.temporal.io/api/enums/v1;enums";
option java_package = "io.temporal.api.enums.v1";
option java_multiple_files = true;
option java_outer_classname = "EventTypeProto";
option ruby_package = "Temporalio::Api::Enums::V1";
option csharp_namespace = "Temporalio.Api.Enums.V1";

// Whenever this list of events is changed do change the function shouldBufferEvent in mutableStateBuilder.go to make sure to do the correct event ordering
enum EventType {
    // Place holder and should never appear in a Workflow execution history
    EVENT_TYPE_UNSPECIFIED = 0;
    // Workflow execution has been triggered/started
    // It contains Workflow execution inputs, as well as Workflow timeout configurations
    EVENT_TYPE_WORKFLOW_EXECUTION_STARTED = 1;
    // Workflow execution has successfully completed and contains Workflow execution results
    EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED = 2;
    // Workflow execution has unsuccessfully completed and contains the Workflow execution error
    EVENT_TYPE_WORKFLOW_EXECUTION_FAILED = 3;
    // Workflow execution has timed out by the Temporal Server
    // Usually due to the Workflow having not been completed within timeout settings
    EVENT_TYPE_WORKFLOW_EXECUTION_TIMED_OUT = 4;
    // Workflow Task has been scheduled and the SDK client should now be able to process any new history events
    EVENT_TYPE_WORKFLOW_TASK_SCHEDULED = 5;
    // Workflow Task has started and the SDK client has picked up the Workflow Task and is processing new history events
    EVENT_TYPE_WORKFLOW_TASK_STARTED = 6;
    // Workflow Task has completed
    // The SDK client picked up the Workflow Task and processed new history events
    // SDK client may or may not ask the Temporal Server to do additional work, such as:
    // EVENT_TYPE_ACTIVITY_TASK_SCHEDULED
    // EVENT_TYPE_TIMER_STARTED
    // EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES
    // EVENT_TYPE_MARKER_RECORDED
    // EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED
    // EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED
    // EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED
    // EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED
    // EVENT_TYPE_WORKFLOW_EXECUTION_FAILED
    // EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED
    // EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW
    EVENT_TYPE_WORKFLOW_TASK_COMPLETED = 7;
    // Workflow Task encountered a timeout
    // Either an SDK client with a local cache was not available at the time, or it took too long for the SDK client to process the task
    EVENT_TYPE_WORKFLOW_TASK_TIMED_OUT = 8;
    // Workflow Task encountered a failure
    // Usually this means that the Workflow was non-deterministic
    // However, the Workflow reset functionality also uses this event
    EVENT_TYPE_WORKFLOW_TASK_FAILED = 9;
    // Activity Task was scheduled
    // The SDK client should pick up this activity task and execute
    // This event type contains activity inputs, as well as activity timeout configurations
    EVENT_TYPE_ACTIVITY_TASK_SCHEDULED = 10;
    // Activity Task has started executing
    // The SDK client has picked up the Activity Task and is processing the Activity invocation
    EVENT_TYPE_ACTIVITY_TASK_STARTED = 11;
    // Activity Task has finished successfully
    // The SDK client has picked up and successfully completed the Activity Task
    // This event type contains Activity execution results
    EVENT_TYPE_ACTIVITY_TASK_COMPLETED = 12;
    // Activity Task has finished unsuccessfully
    // The SDK picked up the Activity Task but unsuccessfully completed it
    // This event type contains Activity execution errors
    EVENT_TYPE_ACTIVITY_TASK_FAILED = 13;
    // Activity has timed out according to the Temporal Server
    // Activity did not complete within the timeout settings
    EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT = 14;
    // A request to cancel the Activity has occurred
    // The SDK client will be able to confirm cancellation of an Activity during an Activity heartbeat
    EVENT_TYPE_ACTIVITY_TASK_CANCEL_REQUESTED = 15;
    // Activity has been cancelled
    EVENT_TYPE_ACTIVITY_TASK_CANCELED = 16;
    // A timer has started
    EVENT_TYPE_TIMER_STARTED = 17;
    // A timer has fired
    EVENT_TYPE_TIMER_FIRED = 18;
    // A time has been cancelled
    EVENT_TYPE_TIMER_CANCELED = 19;
    // A request has been made to cancel the Workflow execution
    EVENT_TYPE_WORKFLOW_EXECUTION_CANCEL_REQUESTED = 20;
    // SDK client has confirmed the cancellation request and the Workflow execution has been cancelled
    EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED = 21;
    // Workflow has requested that the Temporal Server try to cancel another Workflow
    EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED = 22;
    // Temporal Server could not cancel the targeted Workflow
    // This is usually because the target Workflow could not be found
    EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED = 23;
    // Temporal Server has successfully requested the cancellation of the target Workflow
    EVENT_TYPE_EXTERNAL_WORKFLOW_EXECUTION_CANCEL_REQUESTED = 24;
    // A marker has been recorded.
    // This event type is transparent to the Temporal Server
    // The Server will only store it and will not try to understand it.
    EVENT_TYPE_MARKER_RECORDED = 25;
    // Workflow has received a Signal event
    // The event type contains the Signal name, as well as a Signal payload
    EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED = 26;
    // Workflow execution has been forcefully terminated
    // This is usually because the terminate Workflow API was called
    EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED = 27;
    // Workflow has successfully completed and a new Workflow has been started within the same transaction
    // Contains last Workflow execution results as well as new Workflow execution inputs
    EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW = 28;
    // Temporal Server will try to start a child Workflow
    EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED = 29;
    // Child Workflow execution cannot be started/triggered
    // Usually due to a child Workflow ID collision
    EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_FAILED = 30;
    // Child Workflow execution has successfully started/triggered
    EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_STARTED = 31;
    // Child Workflow execution has successfully completed
    EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_COMPLETED = 32;
    // Child Workflow execution has unsuccessfully completed
    EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_FAILED = 33;
    // Child Workflow execution has been cancelled
    EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_CANCELED = 34;
    // Child Workflow execution has timed out by the Temporal Server
    EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_TIMED_OUT = 35;
    // Child Workflow execution has been terminated
    EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_TERMINATED = 36;
    // Temporal Server will try to Signal the targeted Workflow
    // Contains the Signal name, as well as a Signal payload
    EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED = 37;
    // Temporal Server cannot Signal the targeted Workflow
    // Usually because the Workflow could not be found
    EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED = 38;
    // Temporal Server has successfully Signaled the targeted Workflow
    EVENT_TYPE_EXTERNAL_WORKFLOW_EXECUTION_SIGNALED = 39;
    // Workflow search attributes should be updated and synchronized with the visibility store
    EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES = 40;
    // An update was accepted (i.e. validated)
    EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ACCEPTED = 41;
    // An update was rejected (i.e. failed validation)
    EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_REJECTED = 42;
    // An update completed
    EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_COMPLETED = 43;
    // Some property or properties of the workflow as a whole have changed by non-workflow code.
    // The distinction of external vs. command-based modification is important so the SDK can
    // maintain determinism when using the command-based approach.
    EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED_EXTERNALLY = 44;
    // Some property or properties of an already-scheduled activity have changed by non-workflow code.
    // The distinction of external vs. command-based modification is important so the SDK can
    // maintain determinism when using the command-based approach.
    EVENT_TYPE_ACTIVITY_PROPERTIES_MODIFIED_EXTERNALLY = 45;
    // Workflow properties modified by user workflow code
    EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED = 46;
    // An update was admitted. Note that not all admitted updates result in this
    // event. See UpdateAdmittedEventOrigin for situations in which this event
    // is created.
    EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ADMITTED = 47;

    // A Nexus operation was scheduled using a ScheduleNexusOperation command.
    EVENT_TYPE_NEXUS_OPERATION_SCHEDULED = 48;
    // An asynchronous Nexus operation was started by a Nexus handler.
    EVENT_TYPE_NEXUS_OPERATION_STARTED = 49;
    // A Nexus operation completed successfully.
    EVENT_TYPE_NEXUS_OPERATION_COMPLETED = 50;
    // A Nexus operation failed.
    EVENT_TYPE_NEXUS_OPERATION_FAILED = 51;
    // A Nexus operation completed as canceled.
    EVENT_TYPE_NEXUS_OPERATION_CANCELED = 52;
    // A Nexus operation timed out.
    EVENT_TYPE_NEXUS_OPERATION_TIMED_OUT = 53;
    // A Nexus operation was requested to be canceled using a RequestCancelNexusOperation command.
    EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUESTED = 54;
}
