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

/// The properties of the ExascaleDbStorageVault.
/// next ID: 12
public struct ExascaleDbStorageVaultProperties: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Output only. The OCID for the ExascaleDbStorageVault.
  public var ocid: Swift.String = Swift.String()

  /// Output only. The time zone of the ExascaleDbStorageVault.
  public var timeZone: GoogleType.TimeZone? = nil

  /// Required. The storage details of the ExascaleDbStorageVault.
  public var exascaleDbStorageDetails: ExascaleDbStorageDetails? = nil

  /// Output only. The state of the ExascaleDbStorageVault.
  public var state: ExascaleDbStorageVaultProperties.State =
    ExascaleDbStorageVaultProperties.State()

  /// Optional. The description of the ExascaleDbStorageVault.
  public var description: Swift.String = Swift.String()

  /// Output only. The list of VM cluster OCIDs associated with the
  /// ExascaleDbStorageVault.
  public var vmClusterIds: [Swift.String] = []

  /// Output only. The number of VM clusters associated with the
  /// ExascaleDbStorageVault.
  public var vmClusterCount: Swift.Int32 = Swift.Int32()

  /// Optional. The size of additional flash cache in percentage of high capacity
  /// database storage.
  public var additionalFlashCachePercent: Swift.Int32 = Swift.Int32()

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

  /// Output only. The shape attributes of the VM clusters attached to the
  /// ExascaleDbStorageVault.
  public var attachedShapeAttributes: [ExascaleDbStorageVaultProperties.ShapeAttribute] = []

  /// Output only. The shape attributes available for the VM clusters to be
  /// attached to the ExascaleDbStorageVault.
  public var availableShapeAttributes: [ExascaleDbStorageVaultProperties.ShapeAttribute] = []

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

  /// The state of the ExascaleDbStorageVault.
  public enum State: Codable, Equatable, Sendable {
    /// The state of the ExascaleDbStorageVault is unspecified.
    case unspecified
    /// The ExascaleDbStorageVault is being provisioned.
    case provisioning
    /// The ExascaleDbStorageVault is available.
    case available
    /// The ExascaleDbStorageVault is being updated.
    case updating
    /// The ExascaleDbStorageVault is being deleted.
    case terminating
    /// The ExascaleDbStorageVault has been deleted.
    case terminated
    /// The ExascaleDbStorageVault has failed.
    case failed
    /// 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 .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 .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
      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
      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 .unknownIntValue(let v): return try container.encode(v)
      case .unknownStringValue(let v): return try container.encode(v)
      }
    }
  }

  /// The shape attribute of the VM clusters attached to the
  /// ExascaleDbStorageVault.
  public enum ShapeAttribute: Codable, Equatable, Sendable {
    /// Default unspecified value.
    case unspecified
    /// Indicates that the resource is in smart storage.
    case smartStorage
    /// Indicates that the resource is in block storage.
    case blockStorage
    /// 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 .smartStorage: return 1
      case .blockStorage: 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 "SHAPE_ATTRIBUTE_UNSPECIFIED"
      case .smartStorage: return "SMART_STORAGE"
      case .blockStorage: return "BLOCK_STORAGE"
      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:ShapeAttribute/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "SHAPE_ATTRIBUTE_UNSPECIFIED": self = .unspecified
      case "SMART_STORAGE": self = .smartStorage
      case "BLOCK_STORAGE": self = .blockStorage
      default: self = .unknownStringValue(stringValue)
      }
    }

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