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

  /// Represents a Machine Type resource.
  ///
  /// You can use specific machine types for your VM instances based on performance
  /// and pricing requirements. For more information, readMachine Types.
  public struct MachineType: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// [Output Only] A list of accelerator configurations assigned to this
    /// machine type.
    public var accelerators: [MachineType.Accelerators] = []

    /// [Output Only] The architecture of the machine type.
    public var architecture: MachineType.Architecture? = nil

    /// [Output Only] The configuration of bundled local SSD for the machine type.
    public var bundledLocalSsds: BundledLocalSsds? = nil

    /// [Output Only] Creation timestamp inRFC3339
    /// text format.
    public var creationTimestamp: Swift.String? = nil

    /// [Output Only] The deprecation status associated with this machine type.
    /// Only applicable if the machine type is unavailable.
    public var deprecated: DeprecationStatus? = nil

    /// [Output Only] An optional textual description of the resource.
    public var description: Swift.String? = nil

    /// [Output Only] The number of virtual CPUs that are available to the
    /// instance.
    public var guestCpus: Swift.Int32? = nil

    /// [Output Only] The unique identifier for the resource. This identifier is
    /// defined by the server.
    public var id: Swift.UInt64? = nil

    /// [Deprecated] This property is deprecated and will never be populated with
    /// any relevant values.
    public var imageSpaceGb: Swift.Int32? = nil

    /// [Output Only] Whether this machine type has a shared CPU. SeeShared-core machine
    /// types for more information.
    public var isSharedCpu: Swift.Bool? = nil

    /// Output only. [Output Only] The type of the resource. Alwayscompute#machineType for machine types.
    public var kind: Swift.String? = nil

    /// [Output Only] Maximum persistent disks allowed.
    public var maximumPersistentDisks: Swift.Int32? = nil

    /// [Output Only] Maximum total persistent disks size (GB) allowed.
    public var maximumPersistentDisksSizeGb: Swift.Int64? = nil

    /// [Output Only] The amount of physical memory available to the instance,
    /// defined in MB.
    public var memoryMb: Swift.Int32? = nil

    /// [Output Only] Name of the resource.
    public var name: Swift.String? = nil

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

    /// [Output Only] The name of the zone where the machine type resides,
    /// such as us-central1-a.
    public var zone: Swift.String? = nil

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

    /// The message type for the [accelerators][google.cloud.compute.v1.MachineType.accelerators] field.
    ///
    /// [google.cloud.compute.v1.MachineType.accelerators]: <doc:MachineType/Accelerators>
    public struct Accelerators: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Number of accelerator cards exposed to the guest.
      public var guestAcceleratorCount: Swift.Int32? = nil

      /// The accelerator type resource name, not a full URL, e.g.nvidia-tesla-t4.
      public var guestAcceleratorType: Swift.String? = nil

      /// Initialize a new instance of `Accelerators`.
      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 = Accelerators().with { $0.guestAcceleratorCount = ... }
      /// ```
      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.MachineType.accelerators"
      }
      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 [architecture][google.cloud.compute.v1.MachineType.architecture] field.
    ///
    /// [google.cloud.compute.v1.MachineType.architecture]: <doc:MachineType/Architecture>
    public enum Architecture: Codable, Equatable, Sendable {
      /// Default value indicating Architecture is not set.
      case unspecified
      /// Machines with architecture ARM64
      case arm64
      /// Machines with architecture X86_64
      case x8664
      /// 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 = .unspecified
      }

      /// 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 .unspecified: return 0
        case .arm64: return 1
        case .x8664: return 2
        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 .unspecified: return "ARCHITECTURE_UNSPECIFIED"
        case .arm64: return "ARM64"
        case .x8664: return "X86_64"
        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:Architecture/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "ARCHITECTURE_UNSPECIFIED": self = .unspecified
        case "ARM64": self = .arm64
        case "X86_64": self = .x8664
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:Architecture/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .unspecified
        case 1: self = .arm64
        case 2: self = .x8664
        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 .unspecified: return try container.encode(0)
        case .arm64: return try container.encode(1)
        case .x8664: return try container.encode(2)
        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.MachineType"
    }
    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
