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

  /// Contains a list of region resources.
  public struct RegionList: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    GoogleCloudGax._PaginatedResponse,
    Sendable
  {
    /// [Output Only] Unique identifier for the resource; defined by the server.
    public var id: Swift.String? = nil

    /// A list of Region resources.
    public var items: [Region] = []

    /// Output only. [Output Only] Type of resource. Always compute#regionList for
    /// lists of regions.
    public var kind: Swift.String? = nil

    /// [Output Only] This token allows you to get the next page of results for
    /// list requests. If the number of results is larger thanmaxResults, use the nextPageToken as a value for
    /// the query parameter pageToken in the next list request.
    /// Subsequent list requests will have their own nextPageToken to
    /// continue paging through the results.
    public var nextPageToken: Swift.String? = nil

    /// Output only. [Output Only] Server-defined URL for this resource.
    public var selfLink: Swift.String? = nil

    /// [Output Only] Informational warning message.
    public var warning: RegionList.Warning? = nil

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

    /// The message type for the [warning][google.cloud.compute.v1.RegionList.warning] field.
    ///
    /// [google.cloud.compute.v1.RegionList.warning]: <doc:RegionList/Warning>
    public struct Warning: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// [Output Only] A warning code, if applicable. For example, Compute
      /// Engine returns NO_RESULTS_ON_PAGE if there
      /// are no results in the response.
      public var code: RegionList.Warning.Code? = nil

      /// [Output Only] Metadata about this warning in key:
      /// value format. For example:
      ///
      /// "data": [
      ///   {
      ///    "key": "scope",
      ///    "value": "zones/us-east1-d"
      ///   }
      public var data: [RegionList.Warning.Data] = []

      /// [Output Only] A human-readable description of the warning code.
      public var message: Swift.String? = nil

      /// Initialize a new instance of `Warning`.
      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 = Warning().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 [data][google.cloud.compute.v1.RegionList.warning.data] field.
      ///
      /// [google.cloud.compute.v1.RegionList.warning.data]: <doc:RegionList/Warning/Data>
      public struct Data: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        /// [Output Only] A key that provides more detail on the warning being
        /// returned. For example, for warnings where there are no results in a list
        /// request for a particular zone, this key might be scope and
        /// the key value might be the zone name. Other examples might be a key
        /// indicating a deprecated resource and a suggested replacement, or a
        /// warning about invalid network settings (for example, if an instance
        /// attempts to perform IP forwarding but is not enabled for IP forwarding).
        public var key: Swift.String? = nil

        /// [Output Only] A warning data value corresponding to the key.
        public var value: Swift.String? = nil

        /// Initialize a new instance of `Data`.
        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 = Data().with { $0.key = ... }
        /// ```
        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.RegionList.warning.data"
        }
        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)
        }
      }

      /// The enumerated type for the [code][google.cloud.compute.v1.RegionList.warning.code] field.
      ///
      /// [google.cloud.compute.v1.RegionList.warning.code]: <doc:RegionList/Warning/Code>
      public enum Code: Codable, Equatable, Sendable {
        /// Warning about failed cleanup of transient changes made by a failed
        /// operation.
        case cleanupFailed
        /// A link to a deprecated resource was created.
        case deprecatedResourceUsed
        /// When deploying and at least one of the resources has a type marked as
        /// deprecated
        case deprecatedTypeUsed
        /// The user created a boot disk that is larger than image size.
        case diskSizeLargerThanImageSize
        /// When deploying and at least one of the resources has a type marked as
        /// experimental
        case experimentalTypeUsed
        /// Warning that is present in an external api call
        case externalApiWarning
        /// Warning that value of a field has been overridden.
        /// Deprecated unused field.
        @available(*, deprecated)
        case fieldValueOverriden
        /// The operation involved use of an injected kernel, which is deprecated.
        case injectedKernelsDeprecated
        /// A WEIGHTED_MAGLEV backend service is associated with a health check that is
        /// not of type HTTP/HTTPS/HTTP2.
        case invalidHealthCheckForDynamicWieghtedLb
        /// When deploying a deployment with a exceedingly large number of resources
        case largeDeploymentWarning
        /// Resource can't be retrieved due to list overhead quota exceed
        /// which captures the amount of resources filtered out by
        /// user-defined list filter.
        case listOverheadQuotaExceed
        /// A resource depends on a missing type
        case missingTypeDependency
        /// The route's nextHopIp address is not assigned to an instance on the
        /// network.
        case nextHopAddressNotAssigned
        /// The route's next hop instance cannot ip forward.
        case nextHopCannotIpForward
        /// The route's nextHopInstance URL refers to an instance that does not have an
        /// ipv6 interface on the same network as the route.
        case nextHopInstanceHasNoIpv6Interface
        /// The route's nextHopInstance URL refers to an instance that does not exist.
        case nextHopInstanceNotFound
        /// The route's nextHopInstance URL refers to an instance that is not on the
        /// same network as the route.
        case nextHopInstanceNotOnNetwork
        /// The route's next hop instance does not have a status of RUNNING.
        case nextHopNotRunning
        /// Error which is not critical. We decided to continue the process despite
        /// the mentioned error.
        case notCriticalError
        /// No results are present on a particular list page.
        case noResultsOnPage
        /// Success is reported, but some results may be missing due to errors
        case partialSuccess
        /// Quota information is not available to client requests (e.g:
        /// regions.list).
        case quotaInfoUnavailable
        /// The user attempted to use a resource that requires a TOS they have not
        /// accepted.
        case requiredTosAgreement
        /// Warning that a resource is in use.
        case resourceInUseByOtherResourceWarning
        /// One or more of the resources set to auto-delete could not be deleted
        /// because they were in use.
        case resourceNotDeleted
        /// When a resource schema validation is ignored.
        case schemaValidationIgnored
        /// Instance template used in instance group manager is valid as such, but
        /// its application does not make a lot of sense, because it allows only
        /// single instance in instance group.
        case singleInstancePropertyTemplate
        /// When undeclared properties in the schema are present
        case undeclaredProperties
        /// A given scope cannot be reached.
        case unreachable
        /// Encodes an unknown integer value.
        ///
        /// The most common cause for an unknown values is for the service to send
        /// a value unknown to the library. We recommend you update your library to
        /// the latest version.
        case unknownIntValue(Int)
        /// Encodes an unknown string value.
        ///
        /// The most common cause for an unknown values is for the service to send
        /// a value unknown to the library. We recommend you update your library to
        /// the latest version.
        case unknownStringValue(String)

        public init() {
          self = .cleanupFailed
        }

        /// Returns the integer value associated with the enumeration.
        ///
        /// If the enumeration was initialized with an unknown string value, this returns `nil`.
        public var intValue: Int? {
          switch self {
          case .cleanupFailed: return 0
          case .deprecatedResourceUsed: return 1
          case .deprecatedTypeUsed: return 2
          case .diskSizeLargerThanImageSize: return 3
          case .experimentalTypeUsed: return 4
          case .externalApiWarning: return 5
          case .fieldValueOverriden: return 6
          case .injectedKernelsDeprecated: return 7
          case .invalidHealthCheckForDynamicWieghtedLb: return 8
          case .largeDeploymentWarning: return 9
          case .listOverheadQuotaExceed: return 10
          case .missingTypeDependency: return 11
          case .nextHopAddressNotAssigned: return 12
          case .nextHopCannotIpForward: return 13
          case .nextHopInstanceHasNoIpv6Interface: return 14
          case .nextHopInstanceNotFound: return 15
          case .nextHopInstanceNotOnNetwork: return 16
          case .nextHopNotRunning: return 17
          case .notCriticalError: return 18
          case .noResultsOnPage: return 19
          case .partialSuccess: return 20
          case .quotaInfoUnavailable: return 21
          case .requiredTosAgreement: return 22
          case .resourceInUseByOtherResourceWarning: return 23
          case .resourceNotDeleted: return 24
          case .schemaValidationIgnored: return 25
          case .singleInstancePropertyTemplate: return 26
          case .undeclaredProperties: return 27
          case .unreachable: return 28
          case .unknownIntValue(let v): return v
          case .unknownStringValue: return nil
          }
        }

        /// Returns the string value (or name) associated with the enumeration.
        ///
        /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
        public var stringValue: Swift.String? {
          switch self {
          case .cleanupFailed: return "CLEANUP_FAILED"
          case .deprecatedResourceUsed: return "DEPRECATED_RESOURCE_USED"
          case .deprecatedTypeUsed: return "DEPRECATED_TYPE_USED"
          case .diskSizeLargerThanImageSize: return "DISK_SIZE_LARGER_THAN_IMAGE_SIZE"
          case .experimentalTypeUsed: return "EXPERIMENTAL_TYPE_USED"
          case .externalApiWarning: return "EXTERNAL_API_WARNING"
          case .fieldValueOverriden: return "FIELD_VALUE_OVERRIDEN"
          case .injectedKernelsDeprecated: return "INJECTED_KERNELS_DEPRECATED"
          case .invalidHealthCheckForDynamicWieghtedLb:
            return "INVALID_HEALTH_CHECK_FOR_DYNAMIC_WIEGHTED_LB"
          case .largeDeploymentWarning: return "LARGE_DEPLOYMENT_WARNING"
          case .listOverheadQuotaExceed: return "LIST_OVERHEAD_QUOTA_EXCEED"
          case .missingTypeDependency: return "MISSING_TYPE_DEPENDENCY"
          case .nextHopAddressNotAssigned: return "NEXT_HOP_ADDRESS_NOT_ASSIGNED"
          case .nextHopCannotIpForward: return "NEXT_HOP_CANNOT_IP_FORWARD"
          case .nextHopInstanceHasNoIpv6Interface: return "NEXT_HOP_INSTANCE_HAS_NO_IPV6_INTERFACE"
          case .nextHopInstanceNotFound: return "NEXT_HOP_INSTANCE_NOT_FOUND"
          case .nextHopInstanceNotOnNetwork: return "NEXT_HOP_INSTANCE_NOT_ON_NETWORK"
          case .nextHopNotRunning: return "NEXT_HOP_NOT_RUNNING"
          case .notCriticalError: return "NOT_CRITICAL_ERROR"
          case .noResultsOnPage: return "NO_RESULTS_ON_PAGE"
          case .partialSuccess: return "PARTIAL_SUCCESS"
          case .quotaInfoUnavailable: return "QUOTA_INFO_UNAVAILABLE"
          case .requiredTosAgreement: return "REQUIRED_TOS_AGREEMENT"
          case .resourceInUseByOtherResourceWarning:
            return "RESOURCE_IN_USE_BY_OTHER_RESOURCE_WARNING"
          case .resourceNotDeleted: return "RESOURCE_NOT_DELETED"
          case .schemaValidationIgnored: return "SCHEMA_VALIDATION_IGNORED"
          case .singleInstancePropertyTemplate: return "SINGLE_INSTANCE_PROPERTY_TEMPLATE"
          case .undeclaredProperties: return "UNDECLARED_PROPERTIES"
          case .unreachable: return "UNREACHABLE"
          case .unknownIntValue: return nil
          case .unknownStringValue(let v): return v
          }
        }

        /// Initialize from a string value.
        ///
        /// If the value is unknown, this initializes to [`unknownStringValue`](doc:Code/unknownStringValue(_:)).
        public init(stringValue: Swift.String) {
          switch stringValue {
          case "CLEANUP_FAILED": self = .cleanupFailed
          case "DEPRECATED_RESOURCE_USED": self = .deprecatedResourceUsed
          case "DEPRECATED_TYPE_USED": self = .deprecatedTypeUsed
          case "DISK_SIZE_LARGER_THAN_IMAGE_SIZE": self = .diskSizeLargerThanImageSize
          case "EXPERIMENTAL_TYPE_USED": self = .experimentalTypeUsed
          case "EXTERNAL_API_WARNING": self = .externalApiWarning
          case "FIELD_VALUE_OVERRIDEN": self = .fieldValueOverriden
          case "INJECTED_KERNELS_DEPRECATED": self = .injectedKernelsDeprecated
          case "INVALID_HEALTH_CHECK_FOR_DYNAMIC_WIEGHTED_LB":
            self = .invalidHealthCheckForDynamicWieghtedLb
          case "LARGE_DEPLOYMENT_WARNING": self = .largeDeploymentWarning
          case "LIST_OVERHEAD_QUOTA_EXCEED": self = .listOverheadQuotaExceed
          case "MISSING_TYPE_DEPENDENCY": self = .missingTypeDependency
          case "NEXT_HOP_ADDRESS_NOT_ASSIGNED": self = .nextHopAddressNotAssigned
          case "NEXT_HOP_CANNOT_IP_FORWARD": self = .nextHopCannotIpForward
          case "NEXT_HOP_INSTANCE_HAS_NO_IPV6_INTERFACE": self = .nextHopInstanceHasNoIpv6Interface
          case "NEXT_HOP_INSTANCE_NOT_FOUND": self = .nextHopInstanceNotFound
          case "NEXT_HOP_INSTANCE_NOT_ON_NETWORK": self = .nextHopInstanceNotOnNetwork
          case "NEXT_HOP_NOT_RUNNING": self = .nextHopNotRunning
          case "NOT_CRITICAL_ERROR": self = .notCriticalError
          case "NO_RESULTS_ON_PAGE": self = .noResultsOnPage
          case "PARTIAL_SUCCESS": self = .partialSuccess
          case "QUOTA_INFO_UNAVAILABLE": self = .quotaInfoUnavailable
          case "REQUIRED_TOS_AGREEMENT": self = .requiredTosAgreement
          case "RESOURCE_IN_USE_BY_OTHER_RESOURCE_WARNING":
            self = .resourceInUseByOtherResourceWarning
          case "RESOURCE_NOT_DELETED": self = .resourceNotDeleted
          case "SCHEMA_VALIDATION_IGNORED": self = .schemaValidationIgnored
          case "SINGLE_INSTANCE_PROPERTY_TEMPLATE": self = .singleInstancePropertyTemplate
          case "UNDECLARED_PROPERTIES": self = .undeclaredProperties
          case "UNREACHABLE": self = .unreachable
          default: self = .unknownStringValue(stringValue)
          }
        }

        /// Initialize from an integer value.
        ///
        /// If the value is unknown, this initializes to [`unknownIntValue`](doc:Code/unknownIntValue(_:)).
        public init(intValue: Int) {
          switch intValue {
          case 0: self = .cleanupFailed
          case 1: self = .deprecatedResourceUsed
          case 2: self = .deprecatedTypeUsed
          case 3: self = .diskSizeLargerThanImageSize
          case 4: self = .experimentalTypeUsed
          case 5: self = .externalApiWarning
          case 6: self = .fieldValueOverriden
          case 7: self = .injectedKernelsDeprecated
          case 8: self = .invalidHealthCheckForDynamicWieghtedLb
          case 9: self = .largeDeploymentWarning
          case 10: self = .listOverheadQuotaExceed
          case 11: self = .missingTypeDependency
          case 12: self = .nextHopAddressNotAssigned
          case 13: self = .nextHopCannotIpForward
          case 14: self = .nextHopInstanceHasNoIpv6Interface
          case 15: self = .nextHopInstanceNotFound
          case 16: self = .nextHopInstanceNotOnNetwork
          case 17: self = .nextHopNotRunning
          case 18: self = .notCriticalError
          case 19: self = .noResultsOnPage
          case 20: self = .partialSuccess
          case 21: self = .quotaInfoUnavailable
          case 22: self = .requiredTosAgreement
          case 23: self = .resourceInUseByOtherResourceWarning
          case 24: self = .resourceNotDeleted
          case 25: self = .schemaValidationIgnored
          case 26: self = .singleInstancePropertyTemplate
          case 27: self = .undeclaredProperties
          case 28: self = .unreachable
          default: self = .unknownIntValue(intValue)
          }
        }

        public init(from decoder: Decoder) throws {
          let container = try decoder.singleValueContainer()
          if let v = try? container.decode(Int.self) {
            self.init(intValue: v)
            return
          }
          if let s = try? container.decode(String.self) {
            if let v = Int(s) {
              self.init(intValue: v)
            } else {
              self.init(stringValue: s)
            }
            return
          }
          throw DecodingError.dataCorruptedError(
            in: container, debugDescription: "Expected enum value, must be integer or string.")
        }

        public func encode(to encoder: Encoder) throws {
          var container = encoder.singleValueContainer()
          switch self {
          case .cleanupFailed: return try container.encode(0)
          case .deprecatedResourceUsed: return try container.encode(1)
          case .deprecatedTypeUsed: return try container.encode(2)
          case .diskSizeLargerThanImageSize: return try container.encode(3)
          case .experimentalTypeUsed: return try container.encode(4)
          case .externalApiWarning: return try container.encode(5)
          case .fieldValueOverriden: return try container.encode(6)
          case .injectedKernelsDeprecated: return try container.encode(7)
          case .invalidHealthCheckForDynamicWieghtedLb: return try container.encode(8)
          case .largeDeploymentWarning: return try container.encode(9)
          case .listOverheadQuotaExceed: return try container.encode(10)
          case .missingTypeDependency: return try container.encode(11)
          case .nextHopAddressNotAssigned: return try container.encode(12)
          case .nextHopCannotIpForward: return try container.encode(13)
          case .nextHopInstanceHasNoIpv6Interface: return try container.encode(14)
          case .nextHopInstanceNotFound: return try container.encode(15)
          case .nextHopInstanceNotOnNetwork: return try container.encode(16)
          case .nextHopNotRunning: return try container.encode(17)
          case .notCriticalError: return try container.encode(18)
          case .noResultsOnPage: return try container.encode(19)
          case .partialSuccess: return try container.encode(20)
          case .quotaInfoUnavailable: return try container.encode(21)
          case .requiredTosAgreement: return try container.encode(22)
          case .resourceInUseByOtherResourceWarning: return try container.encode(23)
          case .resourceNotDeleted: return try container.encode(24)
          case .schemaValidationIgnored: return try container.encode(25)
          case .singleInstancePropertyTemplate: return try container.encode(26)
          case .undeclaredProperties: return try container.encode(27)
          case .unreachable: return try container.encode(28)
          case .unknownIntValue(let v): return try container.encode(v)
          case .unknownStringValue(let v): return try container.encode(v)
          }
        }
      }

      public static var _anyTypeUrl: Swift.String {
        return "type.googleapis.com/google.cloud.compute.v1.RegionList.warning"
      }
      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.RegionList"
    }
    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 func _getPaginatedItems() -> [Region] {
      return self.items
    }

    public func _nextPageToken() -> Swift.String {
      return self.nextPageToken ?? ""
    }
  }
#endif
