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

import Foundation
import GoogleCloudWkt

/// StoragePool is a container for volumes with a service level and capacity.
/// Volumes can be created in a pool of sufficient available capacity.
/// StoragePool capacity is what you are billed for.
public struct StoragePool: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Identifier. Name of the storage pool
  public var name: Swift.String = Swift.String()

  /// Required. Service level of the storage pool
  public var serviceLevel: ServiceLevel = ServiceLevel()

  /// Required. Capacity in GIB of the pool
  public var capacityGib: Swift.Int64 = Swift.Int64()

  /// Output only. Allocated size of all volumes in GIB in the storage pool
  public var volumeCapacityGib: Swift.Int64 = Swift.Int64()

  /// Output only. Volume count of the storage pool
  public var volumeCount: Swift.Int32 = Swift.Int32()

  /// Output only. State of the storage pool
  public var state: StoragePool.State = StoragePool.State()

  /// Output only. State details of the storage pool
  public var stateDetails: Swift.String = Swift.String()

  /// Output only. Create time of the storage pool
  public var createTime: GoogleCloudWkt.Timestamp? = nil

  /// Optional. Description of the storage pool
  public var description: Swift.String = Swift.String()

  /// Optional. Labels as key value pairs
  public var labels: [Swift.String: Swift.String] = [:]

  /// Required. VPC Network name.
  /// Format: projects/{project}/global/networks/{network}
  public var network: Swift.String = Swift.String()

  /// Optional. Specifies the Active Directory to be used for creating a SMB
  /// volume.
  public var activeDirectory: Swift.String = Swift.String()

  /// Optional. Specifies the KMS config to be used for volume encryption.
  public var kmsConfig: Swift.String = Swift.String()

  /// Optional. Flag indicating if the pool is NFS LDAP enabled or not.
  public var ldapEnabled: Swift.Bool = Swift.Bool()

  /// Optional. This field is not implemented. The values provided in this field
  /// are ignored.
  public var psaRange: Swift.String = Swift.String()

  /// Output only. Specifies the current pool encryption key source.
  public var encryptionType: EncryptionType = EncryptionType()

  /// Deprecated. Used to allow SO pool to access AD or DNS server from other
  /// regions.
  @available(*, deprecated)
  public var globalAccessAllowed: Swift.Bool? = nil

  /// Optional. True if the storage pool supports Auto Tiering enabled volumes.
  /// Default is false. Auto-tiering can be enabled after storage pool creation
  /// but it can't be disabled once enabled.
  public var allowAutoTiering: Swift.Bool = Swift.Bool()

  /// Optional. Specifies the replica zone for regional storagePool.
  public var replicaZone: Swift.String = Swift.String()

  /// Optional. Specifies the active zone for regional storagePool.
  public var zone: Swift.String = Swift.String()

  /// Output only. Reserved for future use
  public var satisfiesPzs: Swift.Bool = Swift.Bool()

  /// Output only. Reserved for future use
  public var satisfiesPzi: Swift.Bool = Swift.Bool()

  /// Optional. True if using Independent Scaling of capacity and performance
  /// (Hyperdisk) By default set to false
  public var customPerformanceEnabled: Swift.Bool = Swift.Bool()

  /// Optional. Custom Performance Total Throughput of the pool (in MiBps)
  public var totalThroughputMibps: Swift.Int64 = Swift.Int64()

  /// Optional. Custom Performance Total IOPS of the pool
  /// if not provided, it will be calculated based on the total_throughput_mibps
  public var totalIops: Swift.Int64 = Swift.Int64()

  /// Optional. Total hot tier capacity for the Storage Pool. It is applicable
  /// only to Flex service level. It should be less than the minimum storage pool
  /// size and cannot be more than the current storage pool size. It cannot be
  /// decreased once set.
  public var hotTierSizeGib: Swift.Int64 = Swift.Int64()

  /// Optional. Flag indicating that the hot-tier threshold will be
  /// auto-increased by 10% of the hot-tier when it hits 100%. Default is true.
  /// The increment will kick in only if the new size after increment is
  /// still less than or equal to storage pool size.
  public var enableHotTierAutoResize: Swift.Bool? = nil

  /// Optional. QoS (Quality of Service) Type of the storage pool
  public var qosType: QosType = QosType()

  /// Output only. Available throughput of the storage pool (in MiB/s).
  public var availableThroughputMibps: Swift.Double = Swift.Double()

  /// Output only. Total cold tier data rounded down to the nearest GiB used by
  /// the storage pool.
  public var coldTierSizeUsedGib: Swift.Int64 = Swift.Int64()

  /// Output only. Total hot tier data rounded down to the nearest GiB used by
  /// the storage pool.
  public var hotTierSizeUsedGib: Swift.Int64 = Swift.Int64()

  /// Optional. Type of the storage pool. This field is used to control whether
  /// the pool supports `FILE` based volumes only or `UNIFIED` (both `FILE` and
  /// `BLOCK`) volumes. If not specified during creation, it defaults to `FILE`.
  public var type: StoragePoolType? = nil

  /// Optional. Mode of the storage pool. This field is used to control whether
  /// the user can perform the ONTAP operations on the storage pool using the
  /// GCNV ONTAP Mode APIs. If not specified during creation, it defaults to
  /// `DEFAULT`.
  public var mode: Mode? = nil

  /// Optional. The scale type of the storage pool. Defaults to
  /// `SCALE_TYPE_DEFAULT` if not specified.
  public var scaleType: ScaleType = ScaleType()

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

  /// The Storage Pool States
  public enum State: Codable, Equatable, Sendable {
    /// Unspecified Storage Pool State
    case unspecified
    /// Storage Pool State is Ready
    case ready
    /// Storage Pool State is Creating
    case creating
    /// Storage Pool State is Deleting
    case deleting
    /// Storage Pool State is Updating
    case updating
    /// Storage Pool State is Restoring
    case restoring
    /// Storage Pool State is Disabled
    case disabled
    /// Storage Pool State is Error
    case error
    /// 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 .ready: return 1
      case .creating: return 2
      case .deleting: return 3
      case .updating: return 4
      case .restoring: return 5
      case .disabled: return 6
      case .error: return 7
      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 "STATE_UNSPECIFIED"
      case .ready: return "READY"
      case .creating: return "CREATING"
      case .deleting: return "DELETING"
      case .updating: return "UPDATING"
      case .restoring: return "RESTORING"
      case .disabled: return "DISABLED"
      case .error: return "ERROR"
      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:State/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "STATE_UNSPECIFIED": self = .unspecified
      case "READY": self = .ready
      case "CREATING": self = .creating
      case "DELETING": self = .deleting
      case "UPDATING": self = .updating
      case "RESTORING": self = .restoring
      case "DISABLED": self = .disabled
      case "ERROR": self = .error
      default: self = .unknownStringValue(stringValue)
      }
    }

    /// Initialize from an integer value.
    ///
    /// If the value is unknown, this initializes to [`unknownIntValue`](doc:State/unknownIntValue(_:)).
    public init(intValue: Int) {
      switch intValue {
      case 0: self = .unspecified
      case 1: self = .ready
      case 2: self = .creating
      case 3: self = .deleting
      case 4: self = .updating
      case 5: self = .restoring
      case 6: self = .disabled
      case 7: self = .error
      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 .ready: return try container.encode(1)
      case .creating: return try container.encode(2)
      case .deleting: return try container.encode(3)
      case .updating: return try container.encode(4)
      case .restoring: return try container.encode(5)
      case .disabled: return try container.encode(6)
      case .error: return try container.encode(7)
      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.netapp.v1.StoragePool"
  }
  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)
  }
}
