// 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 = "UpdateProto";
option ruby_package = "Temporalio::Api::Enums::V1";
option csharp_namespace = "Temporalio.Api.Enums.V1";

// UpdateWorkflowExecutionLifecycleStage is specified by clients invoking
// workflow execution updates and used to indicate to the server how long the
// client wishes to wait for a return value from the RPC. If any value other
// than UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED is sent by the
// client then the RPC will complete before the update is finished and will
// return a handle to the running update so that it can later be polled for
// completion.
enum UpdateWorkflowExecutionLifecycleStage {
    // An unspecified vale for this enum.
    UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_UNSPECIFIED = 0;
    // The gRPC call will not return until the update request has been admitted
    // by the server - it may be the case that due to a considerations like load
    // or resource limits that an update is made to wait before the server will
    // indicate that it has been received and will be processed. This value
    // does not wait for any sort of acknowledgement from a worker.
    UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ADMITTED = 1;
    // The gRPC call will not return until the update has passed validation on
    // a worker.
    UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ACCEPTED = 2;
    // The gRPC call will not return until the update has executed to completion
    // on a worker and has either been rejected or returned a value or an error.
    UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED = 3;
}

// Records why a WorkflowExecutionUpdateAdmittedEvent was written to history.
// Note that not all admitted updates result in this event.
enum UpdateAdmittedEventOrigin {
    UPDATE_ADMITTED_EVENT_ORIGIN_UNSPECIFIED = 0;
    // The UpdateAdmitted event was created when reapplying events during reset
    // or replication. I.e. an accepted update on one branch of workflow history
    // was converted into an admitted update on a different branch.
    UPDATE_ADMITTED_EVENT_ORIGIN_REAPPLY = 1;
}
