// 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.

#if InstanceGroupManagerResizeRequests || RegionInstanceGroupManagerResizeRequests
  import Foundation
  import GoogleCloudWkt

  public struct InstanceGroupManagerResizeRequestStatus: Codable, Equatable, GoogleCloudWkt
      ._AnyPackable,
    Sendable
  {
    /// Output only. Fatal errors encountered during the queueing or provisioning phases of
    /// the ResizeRequest that caused the transition to the FAILED state.
    /// Contrary to the last_attempt errors, this field is final and errors are
    /// never removed from here, as the ResizeRequest is not going to retry.
    public var error: InstanceGroupManagerResizeRequestStatus.Error? = nil

    /// Output only. Information about the last attempt to fulfill the request. The value is
    /// temporary since the ResizeRequest can retry, as long as it's still active
    /// and the last attempt value can either be cleared or replaced with a
    /// different error. Since ResizeRequest retries infrequently, the value may
    /// be stale and no longer show an active problem. The value is cleared when
    /// ResizeRequest transitions to the final state (becomes inactive). If the
    /// final state is FAILED the error describing it will be stored in the
    /// "error" field only.
    public var lastAttempt: InstanceGroupManagerResizeRequestStatusLastAttempt? = nil

    /// Initialize a new instance of `InstanceGroupManagerResizeRequestStatus`.
    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 = InstanceGroupManagerResizeRequestStatus().with { $0.error = ... }
    /// ```
    public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
      var copy = self
      try config(&copy)
      return copy
    }

    /// The message type for the [error][google.cloud.compute.v1.InstanceGroupManagerResizeRequestStatus.error] field.
    ///
    /// [google.cloud.compute.v1.InstanceGroupManagerResizeRequestStatus.error]: <doc:InstanceGroupManagerResizeRequestStatus/Error>
    public struct Error: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// [Output Only] The array of errors encountered while processing this
      /// operation.
      public var errors: [InstanceGroupManagerResizeRequestStatus.Error.Errors] = []

      /// Initialize a new instance of `Error`.
      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 = Error().with { $0.errors = ... }
      /// ```
      public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
        var copy = self
        try config(&copy)
        return copy
      }

      /// The message type for the [errors][google.cloud.compute.v1.InstanceGroupManagerResizeRequestStatus.error.errors] field.
      ///
      /// [google.cloud.compute.v1.InstanceGroupManagerResizeRequestStatus.error.errors]: <doc:InstanceGroupManagerResizeRequestStatus/Error/Errors>
      public struct Errors: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        /// [Output Only] The error type identifier for this error.
        public var code: Swift.String? = nil

        /// [Output Only] An optional list of messages that contain the error
        /// details. There is a set of defined message types to use for providing
        /// details.The syntax depends on the error code. For example,
        /// QuotaExceededInfo will have details when the error code is
        /// QUOTA_EXCEEDED.
        public var errorDetails:
          [InstanceGroupManagerResizeRequestStatus.Error.Errors.ErrorDetails] = []

        /// [Output Only] Indicates the field in the request that caused the error.
        /// This property is optional.
        public var location: Swift.String? = nil

        /// [Output Only] An optional, human-readable error message.
        public var message: Swift.String? = nil

        /// Initialize a new instance of `Errors`.
        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 = Errors().with { $0.code = ... }
        /// ```
        public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
          var copy = self
          try config(&copy)
          return copy
        }

        /// The message type for the [errorDetails][google.cloud.compute.v1.InstanceGroupManagerResizeRequestStatus.error.errors.errorDetails] field.
        ///
        /// [google.cloud.compute.v1.InstanceGroupManagerResizeRequestStatus.error.errors.errorDetails]: <doc:InstanceGroupManagerResizeRequestStatus/Error/Errors/ErrorDetails>
        public struct ErrorDetails: Codable, Equatable, GoogleCloudWkt._AnyPackable,
          Sendable
        {
          /// Error information containing structured domain, reason, and metadata.
          public var errorInfo: ErrorInfo? = nil

          /// Links and information to help the user resolve the error.
          public var help: Help? = nil

          /// A localized human-readable error message intended for end users.
          public var localizedMessage: LocalizedMessage? = nil

          /// Details about quota limits and metrics when a quota is exceeded.
          public var quotaInfo: QuotaExceededInfo? = nil

          /// Initialize a new instance of `ErrorDetails`.
          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 = ErrorDetails().with { $0.errorInfo = ... }
          /// ```
          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.cloud.compute.v1.InstanceGroupManagerResizeRequestStatus.error.errors.errorDetails"
          }
          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.cloud.compute.v1.InstanceGroupManagerResizeRequestStatus.error.errors"
        }
        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.cloud.compute.v1.InstanceGroupManagerResizeRequestStatus.error"
      }
      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.cloud.compute.v1.InstanceGroupManagerResizeRequestStatus"
    }
    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)
    }
  }
#endif
