// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.universalledger.v1;

import "google/api/field_behavior.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.UniversalLedger.V1";
option go_package = "cloud.google.com/go/universalledger/apiv1/universalledgerpb;universalledgerpb";
option java_multiple_files = true;
option java_outer_classname = "StatusEventProto";
option java_package = "com.google.cloud.universalledger.v1";
option php_namespace = "Google\\Cloud\\UniversalLedger\\V1";
option ruby_package = "Google::Cloud::UniversalLedger::V1";

// Represents the type of an event in the processing of a transaction, as
// observed by the validator that the request was routed to.
enum EventType {
  // Unknown or unspecified event.
  EVENT_TYPE_UNSPECIFIED = 0;

  // The transaction was received by this validator directly from a client.
  EVENT_TYPE_RECEIVED = 1;

  // The transaction was broadcasted by this to other validators.
  EVENT_TYPE_BROADCASTED = 2;

  // The transaction was ordered and scheduled for execution by this validator.
  EVENT_TYPE_ORDERED = 3;

  // The execution of the transaction has started.
  EVENT_TYPE_EXECUTION_STARTED = 4;

  // The execution of the transaction has completed.
  EVENT_TYPE_EXECUTION_COMPLETED = 5;

  // The transaction has been finalized by this validator.
  EVENT_TYPE_FINALIZED = 6;
}

// Represents an event in the processing of a transaction as observed by a
// single validator.
//
// All values reported are from the perspective of the validator handling the
// request and may differ from the view of other validators.
message StatusEvent {
  // Output only. The time when the event was recorded by this validator.
  google.protobuf.Timestamp event_time = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The type of the event.
  EventType event_type = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Additional details associated with the event.
  EventDetails event_details = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Represents additional details of a status event.
message EventDetails {
  // The details of the event.
  oneof event_details {
    // Output only. Additional details for an execution event.
    ExecutionDetails execution_details = 1
        [(google.api.field_behavior) = OUTPUT_ONLY];
  }
}

// Additional details for an execution event.
message ExecutionDetails {
  // Output only. The round ID at which the execution event occurred.
  int64 round_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}
