// Code generated by sidekick. DO NOT EDIT.
//
// 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
//
//     https://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.

import Foundation
import GoogleCloudWkt
import GoogleRpc

/// Response message for the Report method.
public struct ReportResponse: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Partial failures, one for each `Operation` in the request that failed
  /// processing. There are three possible combinations of the RPC status:
  ///
  /// 1. The combination of a successful RPC status and an empty `report_errors`
  ///    list indicates a complete success where all `Operations` in the
  ///    request are processed successfully.
  /// 2. The combination of a successful RPC status and a non-empty
  ///    `report_errors` list indicates a partial success where some
  ///    `Operations` in the request succeeded. Each
  ///    `Operation` that failed processing has a corresponding item
  ///    in this list.
  /// 3. A failed RPC status indicates a general non-deterministic failure.
  ///    When this happens, it's impossible to know which of the
  ///    'Operations' in the request succeeded or failed.
  public var reportErrors: [ReportResponse.ReportError] = []

  /// The actual config id used to process the request.
  public var serviceConfigId: Swift.String = Swift.String()

  /// The current service rollout id used to process the request.
  public var serviceRolloutId: Swift.String = Swift.String()

  /// Initialize a new instance of `ReportResponse`.
  public init() {}

  /// Use `config` to return a new instance of this object, with some fields updated.
  ///
  /// Commonly used to initialize the value, for example:
  ///
  /// ```
  /// let value = ReportResponse().with { $0.reportErrors = ... }
  /// ```
  public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
    var copy = self
    try config(&copy)
    return copy
  }

  /// Represents the processing error of one
  /// [Operation][google.api.servicecontrol.v1.Operation] in the request.
  ///
  /// [google.api.servicecontrol.v1.Operation]: <doc:Operation>
  public struct ReportError: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The
    /// [Operation.operation_id][google.api.servicecontrol.v1.Operation.operation_id]
    /// value from the request.
    ///
    /// [google.api.servicecontrol.v1.Operation.operation_id]: <doc:Operation/operationId>
    public var operationId: Swift.String = Swift.String()

    /// Details of the error when processing the
    /// [Operation][google.api.servicecontrol.v1.Operation].
    ///
    /// [google.api.servicecontrol.v1.Operation]: <doc:Operation>
    public var status: GoogleRpc.Status? = nil

    /// Initialize a new instance of `ReportError`.
    public init() {}

    /// Use `config` to return a new instance of this object, with some fields updated.
    ///
    /// Commonly used to initialize the value, for example:
    ///
    /// ```
    /// let value = ReportError().with { $0.operationId = ... }
    /// ```
    public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
      var copy = self
      try config(&copy)
      return copy
    }

    public static var _anyTypeUrl: Swift.String {
      return "type.googleapis.com/google.api.servicecontrol.v1.ReportResponse.ReportError"
    }
    public init(fromAny any: GoogleCloudWkt.`Any`) throws {
      self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
    }
    public func _pack() throws -> GoogleCloudWkt.Struct {
      return try GoogleCloudWkt._slowAnySerialize(message: self)
    }
  }

  public static var _anyTypeUrl: Swift.String {
    return "type.googleapis.com/google.api.servicecontrol.v1.ReportResponse"
  }
  public init(fromAny any: GoogleCloudWkt.`Any`) throws {
    self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
  }
  public func _pack() throws -> GoogleCloudWkt.Struct {
    return try GoogleCloudWkt._slowAnySerialize(message: self)
  }
}
