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

/// Configuration parameters for a new network.
public struct NetworkConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Output only. The name of the network config.
  public var name: Swift.String = Swift.String()

  /// A transient unique identifier to identify a volume within an
  /// ProvisioningConfig request.
  public var id: Swift.String = Swift.String()

  /// The type of this network, either Client or Private.
  public var type: NetworkConfig.Type_ = NetworkConfig.Type_()

  /// Interconnect bandwidth. Set only when type is CLIENT.
  public var bandwidth: NetworkConfig.Bandwidth = NetworkConfig.Bandwidth()

  /// List of VLAN attachments. As of now there are always 2 attachments, but it
  /// is going to change in  the future (multi vlan).
  public var vlanAttachments: [NetworkConfig.IntakeVlanAttachment] = []

  /// CIDR range of the network.
  public var cidr: Swift.String = Swift.String()

  /// Service CIDR, if any.
  public var serviceCidr: NetworkConfig.ServiceCidr = NetworkConfig.ServiceCidr()

  /// User note field, it can be used by customers to add additional information
  /// for the BMS Ops team .
  public var userNote: Swift.String = Swift.String()

  /// The GCP service of the network. Available gcp_service are in
  /// https://cloud.google.com/bare-metal/docs/bms-planning.
  public var gcpService: Swift.String = Swift.String()

  /// Whether the VLAN attachment pair is located in the same project.
  public var vlanSameProject: Swift.Bool = Swift.Bool()

  /// The JumboFramesEnabled option for customer to set.
  public var jumboFramesEnabled: Swift.Bool = Swift.Bool()

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

  /// A GCP vlan attachment.
  public struct IntakeVlanAttachment: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Identifier of the VLAN attachment.
    public var id: Swift.String = Swift.String()

    /// Attachment pairing key.
    public var pairingKey: Swift.String = Swift.String()

    /// Initialize a new instance of `IntakeVlanAttachment`.
    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 = IntakeVlanAttachment().with { $0.id = ... }
    /// ```
    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.baremetalsolution.v2.NetworkConfig.IntakeVlanAttachment"
    }
    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)
    }
  }

  /// Network type.
  public enum Type_: Codable, Equatable, Sendable {
    /// Unspecified value.
    case unspecified
    /// Client network, that is a network peered to a GCP VPC.
    case client
    /// Private network, that is a network local to the BMS POD.
    case `private`
    /// 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 .client: return 1
      case .`private`: 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 "TYPE_UNSPECIFIED"
      case .client: return "CLIENT"
      case .`private`: return "PRIVATE"
      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:Type_/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "TYPE_UNSPECIFIED": self = .unspecified
      case "CLIENT": self = .client
      case "PRIVATE": self = .`private`
      default: self = .unknownStringValue(stringValue)
      }
    }

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

  /// Interconnect bandwidth.
  public enum Bandwidth: Codable, Equatable, Sendable {
    /// Unspecified value.
    case unspecified
    /// 1 Gbps.
    case bw1Gbps
    /// 2 Gbps.
    case bw2Gbps
    /// 5 Gbps.
    case bw5Gbps
    /// 10 Gbps.
    case bw10Gbps
    /// 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 .bw1Gbps: return 1
      case .bw2Gbps: return 2
      case .bw5Gbps: return 3
      case .bw10Gbps: return 4
      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 "BANDWIDTH_UNSPECIFIED"
      case .bw1Gbps: return "BW_1_GBPS"
      case .bw2Gbps: return "BW_2_GBPS"
      case .bw5Gbps: return "BW_5_GBPS"
      case .bw10Gbps: return "BW_10_GBPS"
      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:Bandwidth/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "BANDWIDTH_UNSPECIFIED": self = .unspecified
      case "BW_1_GBPS": self = .bw1Gbps
      case "BW_2_GBPS": self = .bw2Gbps
      case "BW_5_GBPS": self = .bw5Gbps
      case "BW_10_GBPS": self = .bw10Gbps
      default: self = .unknownStringValue(stringValue)
      }
    }

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

  /// Service network block.
  public enum ServiceCidr: Codable, Equatable, Sendable {
    /// Unspecified value.
    case unspecified
    /// Services are disabled for the given network.
    case disabled
    /// Use the highest /26 block of the network to host services.
    case high26
    /// Use the highest /27 block of the network to host services.
    case high27
    /// Use the highest /28 block of the network to host services.
    case high28
    /// 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 .disabled: return 1
      case .high26: return 2
      case .high27: return 3
      case .high28: return 4
      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 "SERVICE_CIDR_UNSPECIFIED"
      case .disabled: return "DISABLED"
      case .high26: return "HIGH_26"
      case .high27: return "HIGH_27"
      case .high28: return "HIGH_28"
      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:ServiceCidr/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "SERVICE_CIDR_UNSPECIFIED": self = .unspecified
      case "DISABLED": self = .disabled
      case "HIGH_26": self = .high26
      case "HIGH_27": self = .high27
      case "HIGH_28": self = .high28
      default: self = .unknownStringValue(stringValue)
      }
    }

    /// Initialize from an integer value.
    ///
    /// If the value is unknown, this initializes to [`unknownIntValue`](doc:ServiceCidr/unknownIntValue(_:)).
    public init(intValue: Int) {
      switch intValue {
      case 0: self = .unspecified
      case 1: self = .disabled
      case 2: self = .high26
      case 3: self = .high27
      case 4: self = .high28
      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 .disabled: return try container.encode(1)
      case .high26: return try container.encode(2)
      case .high27: return try container.encode(3)
      case .high28: return try container.encode(4)
      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.baremetalsolution.v2.NetworkConfig"
  }
  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)
  }
}
