// 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.protocol.v1;

option go_package = "go.temporal.io/api/protocol/v1;protocol";
option java_package = "io.temporal.api.protocol.v1";
option java_multiple_files = true;
option java_outer_classname = "MessageProto";
option ruby_package = "Temporalio::Api::Protocol::V1";
option csharp_namespace = "Temporalio.Api.Protocol.V1";

import "google/protobuf/any.proto";

// (-- api-linter: core::0146::any=disabled
//     aip.dev/not-precedent: We want runtime extensibility for the body field --)
message Message {
    // An ID for this specific message.
    string id = 1;

    // Identifies the specific instance of a protocol to which this message
    // belongs.
    string protocol_instance_id = 2;

    // The event ID or command ID after which this message can be delivered. The
    // effects of history up to and including this event ID should be visible to
    // the code that handles this message. Omit to opt out of sequencing.
    oneof sequencing_id {
        int64 event_id = 3;
        int64 command_index = 4;
    };
    
    // The opaque data carried by this message. The protocol type can be
    // extracted from the package name of the message carried inside the Any.
    google.protobuf.Any body = 5;
}
