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


// ScheduleOverlapPolicy controls what happens when a workflow would be started
// by a schedule, and is already running.
enum ScheduleOverlapPolicy {
    SCHEDULE_OVERLAP_POLICY_UNSPECIFIED = 0;
    // SCHEDULE_OVERLAP_POLICY_SKIP (default) means don't start anything. When the
    // workflow completes, the next scheduled event after that time will be considered.
    SCHEDULE_OVERLAP_POLICY_SKIP = 1;
    // SCHEDULE_OVERLAP_POLICY_BUFFER_ONE means start the workflow again soon as the
    // current one completes, but only buffer one start in this way. If another start is
    // supposed to happen when the workflow is running, and one is already buffered, then
    // only the first one will be started after the running workflow finishes.
    SCHEDULE_OVERLAP_POLICY_BUFFER_ONE = 2;
    // SCHEDULE_OVERLAP_POLICY_BUFFER_ALL means buffer up any number of starts to all
    // happen sequentially, immediately after the running workflow completes.
    SCHEDULE_OVERLAP_POLICY_BUFFER_ALL = 3;
    // SCHEDULE_OVERLAP_POLICY_CANCEL_OTHER means that if there is another workflow
    // running, cancel it, and start the new one after the old one completes cancellation.
    SCHEDULE_OVERLAP_POLICY_CANCEL_OTHER = 4;
    // SCHEDULE_OVERLAP_POLICY_TERMINATE_OTHER means that if there is another workflow
    // running, terminate it and start the new one immediately.
    SCHEDULE_OVERLAP_POLICY_TERMINATE_OTHER = 5;
    // SCHEDULE_OVERLAP_POLICY_ALLOW_ALL means start any number of concurrent workflows.
    // Note that with this policy, last completion result and last failure will not be
    // available since workflows are not sequential.
    SCHEDULE_OVERLAP_POLICY_ALLOW_ALL = 6;
}
