// 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 InstanceGroupManagers || RegionInstanceGroupManagers
  import Foundation
  import GoogleCloudWkt

  public struct InstanceGroupManagerActionsSummary: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Output only. The total number of instances in the managed instance group
    /// that are scheduled to be abandoned. Abandoning an instance removes it
    /// from the managed instance group without deleting it.
    public var abandoning: Swift.Int32? = nil

    /// Output only. The number of instances in the managed instance group that
    /// are scheduled to be created or are currently being created. If the group
    /// fails to create any of these instances, it tries again until it creates
    /// the instance successfully.
    ///
    /// If you have disabled creation retries, this field will not be populated;
    /// instead, the creatingWithoutRetries field will be populated.
    public var creating: Swift.Int32? = nil

    /// Output only. The number of instances that the managed instance group
    /// will attempt to create. The group attempts to create each instance
    /// only once. If the group fails to create any of these instances, it
    /// decreases the group's targetSize value accordingly.
    public var creatingWithoutRetries: Swift.Int32? = nil

    /// Output only. The number of instances in the managed instance group that
    /// are scheduled to be deleted or are currently being deleted.
    public var deleting: Swift.Int32? = nil

    /// Output only. The number of instances in the managed instance group that
    /// are running and have no scheduled actions.
    public var `none`: Swift.Int32? = nil

    /// Output only. The number of instances in the managed instance group that
    /// are scheduled to be recreated or are currently being being recreated.
    /// Recreating an instance deletes the existing root persistent disk
    /// and creates a new disk from the image that is defined in the
    /// instance template.
    public var recreating: Swift.Int32? = nil

    /// Output only. The number of instances in the managed instance group that
    /// are being reconfigured with properties that do not require a restart
    /// or a recreate action. For example, setting or removing target
    /// pools for the instance.
    public var refreshing: Swift.Int32? = nil

    /// Output only. The number of instances in the managed instance group that
    /// are scheduled to be restarted or are currently being restarted.
    public var restarting: Swift.Int32? = nil

    /// Output only. The number of instances in the managed instance group that
    /// are scheduled to be resumed or are currently being resumed.
    public var resuming: Swift.Int32? = nil

    /// Output only. The number of instances in the managed instance group that
    /// are scheduled to be started or are currently being started.
    public var starting: Swift.Int32? = nil

    /// Output only. The number of instances in the managed instance group that
    /// are scheduled to be stopped or are currently being stopped.
    public var stopping: Swift.Int32? = nil

    /// Output only. The number of instances in the managed instance group that
    /// are scheduled to be suspended or are currently being suspended.
    public var suspending: Swift.Int32? = nil

    /// Output only. The number of instances in the managed instance group that
    /// are being verified. See the managedInstances[].currentAction
    /// property in the listManagedInstances method documentation.
    public var verifying: Swift.Int32? = nil

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

    private enum CodingKeys: Swift.String, CodingKey {
      case abandoning = "abandoning"
      case creating = "creating"
      case creatingWithoutRetries = "creatingWithoutRetries"
      case deleting = "deleting"
      case `none` = "none"
      case recreating = "recreating"
      case refreshing = "refreshing"
      case restarting = "restarting"
      case resuming = "resuming"
      case starting = "starting"
      case stopping = "stopping"
      case suspending = "suspending"
      case verifying = "verifying"
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.container(keyedBy: CodingKeys.self)
      self.abandoning = try container.decodeIfPresent(Swift.Int32.self, forKey: .abandoning)
      self.creating = try container.decodeIfPresent(Swift.Int32.self, forKey: .creating)
      self.creatingWithoutRetries = try container.decodeIfPresent(
        Swift.Int32.self, forKey: .creatingWithoutRetries)
      self.deleting = try container.decodeIfPresent(Swift.Int32.self, forKey: .deleting)
      self.`none` = try container.decodeIfPresent(Swift.Int32.self, forKey: .`none`)
      self.recreating = try container.decodeIfPresent(Swift.Int32.self, forKey: .recreating)
      self.refreshing = try container.decodeIfPresent(Swift.Int32.self, forKey: .refreshing)
      self.restarting = try container.decodeIfPresent(Swift.Int32.self, forKey: .restarting)
      self.resuming = try container.decodeIfPresent(Swift.Int32.self, forKey: .resuming)
      self.starting = try container.decodeIfPresent(Swift.Int32.self, forKey: .starting)
      self.stopping = try container.decodeIfPresent(Swift.Int32.self, forKey: .stopping)
      self.suspending = try container.decodeIfPresent(Swift.Int32.self, forKey: .suspending)
      self.verifying = try container.decodeIfPresent(Swift.Int32.self, forKey: .verifying)
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.container(keyedBy: CodingKeys.self)
      try container.encode(self.abandoning, forKey: .abandoning)
      try container.encode(self.creating, forKey: .creating)
      try container.encode(self.creatingWithoutRetries, forKey: .creatingWithoutRetries)
      try container.encode(self.deleting, forKey: .deleting)
      try container.encode(self.`none`, forKey: .`none`)
      try container.encode(self.recreating, forKey: .recreating)
      try container.encode(self.refreshing, forKey: .refreshing)
      try container.encode(self.restarting, forKey: .restarting)
      try container.encode(self.resuming, forKey: .resuming)
      try container.encode(self.starting, forKey: .starting)
      try container.encode(self.stopping, forKey: .stopping)
      try container.encode(self.suspending, forKey: .suspending)
      try container.encode(self.verifying, forKey: .verifying)
    }

    public static var _anyTypeUrl: Swift.String {
      return "type.googleapis.com/google.cloud.compute.v1.InstanceGroupManagerActionsSummary"
    }
    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
