// 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.saasplatform.saasservicemgmt.logging.v1;

import "google/api/field_behavior.proto";
import "google/cloud/saasplatform/saasservicemgmt/v1beta1/deployments_resources.proto";
import "google/rpc/status.proto";

option csharp_namespace = "Google.Cloud.SaasPlatform.SaasServiceMgmt.Logging.V1";
option go_package = "cloud.google.com/go/saasplatform/saasservicemgmt/logging/apiv1/loggingpb;loggingpb";
option java_multiple_files = true;
option java_outer_classname = "UnitOperationLogProto";
option java_package = "com.google.cloud.saasplatform.saasservicemgmt.logging.v1";
option php_namespace = "Google\\Cloud\\SaasPlatform\\SaasServiceMgmt\\Logging\\V1";
option ruby_package = "Google::Cloud::SaasPlatform::SaasServiceMgmt::Logging::V1";

// Log message for Unit Operation events.
message UnitOperationLog {
  // Unique identifier for the unit operation and the trace id for correlating
  // with engine logs.
  string unit_operation_id = 1;

  // Human-readable message indicating details about the last transition.
  // e.g. ‘Invalid resource state for Cloud Build: Cloud Build returned a
  // failure status’
  string message = 2;

  // Short description for the unit operation's last transition or error.
  string reason = 3;

  // Error following actionable error message specified in
  // https://google.aip.dev/193
  google.rpc.Status error = 4;

  // Output only. The unit state at the time of emitting the log. The last log
  // entry for an operation should end in a terminal state.
  google.cloud.saasplatform.saasservicemgmt.v1beta1.Unit.UnitState unit_state =
      5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The previous unit state. It will be the same as unit_state if
  // there is no state change.
  google.cloud.saasplatform.saasservicemgmt.v1beta1.Unit.UnitState
      prev_unit_state = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The unit operation state at the time of emitting the log.
  google.cloud.saasplatform.saasservicemgmt.v1beta1.UnitOperation
      .UnitOperationState unit_operation_state = 7
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // The type of unit operation (e.g., "PROVISION", "UPGRADE").
  string unit_operation_type = 8;
}
