// 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
import GoogleType

/// Various properties and settings associated with Exadata VM cluster.
public struct CloudVmClusterProperties: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Output only. Oracle Cloud Infrastructure ID of VM Cluster.
  public var ocid: Swift.String = Swift.String()

  /// Required. License type of VM Cluster.
  public var licenseType: CloudVmClusterProperties.LicenseType =
    CloudVmClusterProperties.LicenseType()

  /// Optional. Grid Infrastructure Version.
  public var giVersion: Swift.String = Swift.String()

  /// Optional. Time zone of VM Cluster to set. Defaults to UTC if not specified.
  public var timeZone: GoogleType.TimeZone? = nil

  /// Optional. SSH public keys to be stored with cluster.
  public var sshPublicKeys: [Swift.String] = []

  /// Optional. Number of database servers.
  public var nodeCount: Swift.Int32 = Swift.Int32()

  /// Output only. Shape of VM Cluster.
  public var shape: Swift.String = Swift.String()

  /// Optional. OCPU count per VM. Minimum is 0.1.
  public var ocpuCount: Swift.Float = Swift.Float()

  /// Optional. Memory allocated in GBs.
  public var memorySizeGb: Swift.Int32 = Swift.Int32()

  /// Optional. Local storage per VM.
  public var dbNodeStorageSizeGb: Swift.Int32 = Swift.Int32()

  /// Output only. The storage allocation for the disk group, in gigabytes (GB).
  public var storageSizeGb: Swift.Int32 = Swift.Int32()

  /// Optional. The data disk group size to be allocated in TBs.
  public var dataStorageSizeTb: Swift.Double = Swift.Double()

  /// Optional. The type of redundancy.
  public var diskRedundancy: CloudVmClusterProperties.DiskRedundancy =
    CloudVmClusterProperties.DiskRedundancy()

  /// Optional. Use exadata sparse snapshots.
  public var sparseDiskgroupEnabled: Swift.Bool = Swift.Bool()

  /// Optional. Use local backup.
  public var localBackupEnabled: Swift.Bool = Swift.Bool()

  /// Optional. Prefix for VM cluster host names.
  public var hostnamePrefix: Swift.String = Swift.String()

  /// Optional. Data collection options for diagnostics.
  public var diagnosticsDataCollectionOptions: DataCollectionOptions? = nil

  /// Output only. State of the cluster.
  public var state: CloudVmClusterProperties.State = CloudVmClusterProperties.State()

  /// Optional. SCAN listener port - TCP
  public var scanListenerPortTcp: Swift.Int32 = Swift.Int32()

  /// Optional. SCAN listener port - TLS
  public var scanListenerPortTcpSsl: Swift.Int32 = Swift.Int32()

  /// Output only. Parent DNS domain where SCAN DNS and hosts names are
  /// qualified. ex: ocispdelegated.ocisp10jvnet.oraclevcn.com
  public var domain: Swift.String = Swift.String()

  /// Output only. SCAN DNS name.
  /// ex: sp2-yi0xq-scan.ocispdelegated.ocisp10jvnet.oraclevcn.com
  public var scanDns: Swift.String = Swift.String()

  /// Output only. host name without domain.
  /// format: "<hostname_prefix>-" with some suffix.
  /// ex: sp2-yi0xq where "sp2" is the hostname_prefix.
  public var hostname: Swift.String = Swift.String()

  /// Required. Number of enabled CPU cores.
  public var cpuCoreCount: Swift.Int32 = Swift.Int32()

  /// Optional. Operating system version of the image.
  public var systemVersion: Swift.String = Swift.String()

  /// Output only. OCIDs of scan IPs.
  public var scanIpIds: [Swift.String] = []

  /// Output only. OCID of scan DNS record.
  public var scanDnsRecordId: Swift.String = Swift.String()

  /// Output only. Deep link to the OCI console to view this resource.
  public var ociUrl: Swift.String = Swift.String()

  /// Optional. OCID of database servers.
  public var dbServerOcids: [Swift.String] = []

  /// Output only. Compartment ID of cluster.
  public var compartmentId: Swift.String = Swift.String()

  /// Output only. DNS listener IP.
  public var dnsListenerIp: Swift.String = Swift.String()

  /// Optional. OCI Cluster name.
  public var clusterName: Swift.String = Swift.String()

  /// Output only. The compute model of the VM Cluster.
  public var computeModel: ComputeModel = ComputeModel()

  /// Output only. The storage management type of the VM Cluster.
  public var storageManagementType: CloudVmClusterProperties.StorageManagementType =
    CloudVmClusterProperties.StorageManagementType()

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

  /// Different licenses supported.
  public enum LicenseType: Codable, Equatable, Sendable {
    /// Unspecified
    case unspecified
    /// License included part of offer
    case licenseIncluded
    /// Bring your own license
    case bringYourOwnLicense
    /// 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 .licenseIncluded: return 1
      case .bringYourOwnLicense: 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 "LICENSE_TYPE_UNSPECIFIED"
      case .licenseIncluded: return "LICENSE_INCLUDED"
      case .bringYourOwnLicense: return "BRING_YOUR_OWN_LICENSE"
      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:LicenseType/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "LICENSE_TYPE_UNSPECIFIED": self = .unspecified
      case "LICENSE_INCLUDED": self = .licenseIncluded
      case "BRING_YOUR_OWN_LICENSE": self = .bringYourOwnLicense
      default: self = .unknownStringValue(stringValue)
      }
    }

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

  /// Types of disk redundancy provided by Oracle.
  public enum DiskRedundancy: Codable, Equatable, Sendable {
    /// Unspecified.
    case unspecified
    /// High -  3 way mirror.
    case high
    /// Normal - 2 way mirror.
    case normal
    /// 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 .high: return 1
      case .normal: 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 "DISK_REDUNDANCY_UNSPECIFIED"
      case .high: return "HIGH"
      case .normal: return "NORMAL"
      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:DiskRedundancy/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "DISK_REDUNDANCY_UNSPECIFIED": self = .unspecified
      case "HIGH": self = .high
      case "NORMAL": self = .normal
      default: self = .unknownStringValue(stringValue)
      }
    }

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

  /// The various lifecycle states of the VM cluster.
  public enum State: Codable, Equatable, Sendable {
    /// Default unspecified value.
    case unspecified
    /// Indicates that the resource is in provisioning state.
    case provisioning
    /// Indicates that the resource is in available state.
    case available
    /// Indicates that the resource is in updating state.
    case updating
    /// Indicates that the resource is in terminating state.
    case terminating
    /// Indicates that the resource is in terminated state.
    case terminated
    /// Indicates that the resource is in failed state.
    case failed
    /// Indicates that the resource is in maintenance in progress state.
    case maintenanceInProgress
    /// 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 .provisioning: return 1
      case .available: return 2
      case .updating: return 3
      case .terminating: return 4
      case .terminated: return 5
      case .failed: return 6
      case .maintenanceInProgress: 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 .provisioning: return "PROVISIONING"
      case .available: return "AVAILABLE"
      case .updating: return "UPDATING"
      case .terminating: return "TERMINATING"
      case .terminated: return "TERMINATED"
      case .failed: return "FAILED"
      case .maintenanceInProgress: return "MAINTENANCE_IN_PROGRESS"
      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 "PROVISIONING": self = .provisioning
      case "AVAILABLE": self = .available
      case "UPDATING": self = .updating
      case "TERMINATING": self = .terminating
      case "TERMINATED": self = .terminated
      case "FAILED": self = .failed
      case "MAINTENANCE_IN_PROGRESS": self = .maintenanceInProgress
      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 = .provisioning
      case 2: self = .available
      case 3: self = .updating
      case 4: self = .terminating
      case 5: self = .terminated
      case 6: self = .failed
      case 7: self = .maintenanceInProgress
      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 .provisioning: return try container.encode(1)
      case .available: return try container.encode(2)
      case .updating: return try container.encode(3)
      case .terminating: return try container.encode(4)
      case .terminated: return try container.encode(5)
      case .failed: return try container.encode(6)
      case .maintenanceInProgress: return try container.encode(7)
      case .unknownIntValue(let v): return try container.encode(v)
      case .unknownStringValue(let v): return try container.encode(v)
      }
    }
  }

  /// The type of storage management for the Cloud VM Cluster.
  public enum StorageManagementType: Codable, Equatable, Sendable {
    /// Unspecified storage management type.
    case unspecified
    /// Automatic Storage Management.
    case asm
    /// Exascale storage management.
    case exascale
    /// 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 .asm: return 1
      case .exascale: 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 "STORAGE_MANAGEMENT_TYPE_UNSPECIFIED"
      case .asm: return "ASM"
      case .exascale: return "EXASCALE"
      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:StorageManagementType/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "STORAGE_MANAGEMENT_TYPE_UNSPECIFIED": self = .unspecified
      case "ASM": self = .asm
      case "EXASCALE": self = .exascale
      default: self = .unknownStringValue(stringValue)
      }
    }

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