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

  public struct InstanceGroupManagersSetTargetPoolsRequest: Codable, Equatable, GoogleCloudWkt
      ._AnyPackable,
    Sendable
  {
    /// The fingerprint of the target pools information. Use this optional
    /// property to prevent conflicts when multiple users change the target pools
    /// settings concurrently. Obtain the fingerprint with theinstanceGroupManagers.get
    /// method. Then, include the fingerprint in your request to ensure that you
    /// do not overwrite changes that were applied from another
    /// concurrent request.
    public var fingerprint: Foundation.Data? = nil

    /// The list of target pool URLs that instances in this managed instance group
    /// belong to. The managed instance group applies these target pools to all
    /// of the instances in the group. Existing instances and new instances in the
    /// group all receive these target pool settings.
    public var targetPools: [Swift.String] = []

    /// Initialize a new instance of `InstanceGroupManagersSetTargetPoolsRequest`.
    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 = InstanceGroupManagersSetTargetPoolsRequest().with { $0.fingerprint = ... }
    /// ```
    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 fingerprint = "fingerprint"
      case targetPools = "targetPools"
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.container(keyedBy: CodingKeys.self)
      if let s = try container.decodeIfPresent(Swift.String.self, forKey: .fingerprint) {
        guard let v = GoogleCloudWkt._DiscoveryBase64.decode(s) else {
          throw DecodingError.dataCorrupted(
            DecodingError.Context(
              codingPath: decoder.codingPath, debugDescription: "Expected url-safe encoded value")
          )
        }
        self.fingerprint = v
      }
      self.targetPools = try container.decode([Swift.String].self, forKey: .targetPools)
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.container(keyedBy: CodingKeys.self)
      if let v = fingerprint {
        try container.encode(
          GoogleCloudWkt._DiscoveryBase64.encode(v), forKey: .fingerprint
        )
      }
      try container.encode(self.targetPools, forKey: .targetPools)
    }

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