// DO NOT EDIT.
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: akash/base/v1beta1/resource.proto
//
// For information on using the generated types, please see the documentation:
//   https://github.com/apple/swift-protobuf/

import Foundation
import SwiftProtobuf

// If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is
// incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that you are building against the same version of the API
// that was used to generate this file.
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  typealias Version = _2
}

/// CPU stores resource units and cpu config attributes
struct Akash_Base_V1beta1_CPU {
  // SwiftProtobuf.Message conformance is added in an extension below. See the
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  // methods supported on all messages.

  var units: Akash_Base_V1beta1_ResourceValue {
    get {return _units ?? Akash_Base_V1beta1_ResourceValue()}
    set {_units = newValue}
  }
  /// Returns true if `units` has been explicitly set.
  var hasUnits: Bool {return self._units != nil}
  /// Clears the value of `units`. Subsequent reads from it will return its default value.
  mutating func clearUnits() {self._units = nil}

  var attributes: [Akash_Base_V1beta1_Attribute] = []

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _units: Akash_Base_V1beta1_ResourceValue? = nil
}

/// Memory stores resource quantity and memory attributes
struct Akash_Base_V1beta1_Memory {
  // SwiftProtobuf.Message conformance is added in an extension below. See the
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  // methods supported on all messages.

  var quantity: Akash_Base_V1beta1_ResourceValue {
    get {return _quantity ?? Akash_Base_V1beta1_ResourceValue()}
    set {_quantity = newValue}
  }
  /// Returns true if `quantity` has been explicitly set.
  var hasQuantity: Bool {return self._quantity != nil}
  /// Clears the value of `quantity`. Subsequent reads from it will return its default value.
  mutating func clearQuantity() {self._quantity = nil}

  var attributes: [Akash_Base_V1beta1_Attribute] = []

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _quantity: Akash_Base_V1beta1_ResourceValue? = nil
}

/// Storage stores resource quantity and storage attributes
struct Akash_Base_V1beta1_Storage {
  // SwiftProtobuf.Message conformance is added in an extension below. See the
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  // methods supported on all messages.

  var quantity: Akash_Base_V1beta1_ResourceValue {
    get {return _quantity ?? Akash_Base_V1beta1_ResourceValue()}
    set {_quantity = newValue}
  }
  /// Returns true if `quantity` has been explicitly set.
  var hasQuantity: Bool {return self._quantity != nil}
  /// Clears the value of `quantity`. Subsequent reads from it will return its default value.
  mutating func clearQuantity() {self._quantity = nil}

  var attributes: [Akash_Base_V1beta1_Attribute] = []

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _quantity: Akash_Base_V1beta1_ResourceValue? = nil
}

/// ResourceUnits describes all available resources types for deployment/node etc
/// if field is nil resource is not present in the given data-structure
struct Akash_Base_V1beta1_ResourceUnits {
  // SwiftProtobuf.Message conformance is added in an extension below. See the
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  // methods supported on all messages.

  var cpu: Akash_Base_V1beta1_CPU {
    get {return _cpu ?? Akash_Base_V1beta1_CPU()}
    set {_cpu = newValue}
  }
  /// Returns true if `cpu` has been explicitly set.
  var hasCpu: Bool {return self._cpu != nil}
  /// Clears the value of `cpu`. Subsequent reads from it will return its default value.
  mutating func clearCpu() {self._cpu = nil}

  var memory: Akash_Base_V1beta1_Memory {
    get {return _memory ?? Akash_Base_V1beta1_Memory()}
    set {_memory = newValue}
  }
  /// Returns true if `memory` has been explicitly set.
  var hasMemory: Bool {return self._memory != nil}
  /// Clears the value of `memory`. Subsequent reads from it will return its default value.
  mutating func clearMemory() {self._memory = nil}

  var storage: Akash_Base_V1beta1_Storage {
    get {return _storage ?? Akash_Base_V1beta1_Storage()}
    set {_storage = newValue}
  }
  /// Returns true if `storage` has been explicitly set.
  var hasStorage: Bool {return self._storage != nil}
  /// Clears the value of `storage`. Subsequent reads from it will return its default value.
  mutating func clearStorage() {self._storage = nil}

  var endpoints: [Akash_Base_V1beta1_Endpoint] = []

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _cpu: Akash_Base_V1beta1_CPU? = nil
  fileprivate var _memory: Akash_Base_V1beta1_Memory? = nil
  fileprivate var _storage: Akash_Base_V1beta1_Storage? = nil
}

// MARK: - Code below here is support for the SwiftProtobuf runtime.

fileprivate let _protobuf_package = "akash.base.v1beta1"

extension Akash_Base_V1beta1_CPU: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".CPU"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "units"),
    2: .same(proto: "attributes"),
  ]

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularMessageField(value: &self._units)
      case 2: try decoder.decodeRepeatedMessageField(value: &self.attributes)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if let v = self._units {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
    }
    if !self.attributes.isEmpty {
      try visitor.visitRepeatedMessageField(value: self.attributes, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: Akash_Base_V1beta1_CPU, rhs: Akash_Base_V1beta1_CPU) -> Bool {
    if lhs._units != rhs._units {return false}
    if lhs.attributes != rhs.attributes {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension Akash_Base_V1beta1_Memory: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".Memory"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "quantity"),
    2: .same(proto: "attributes"),
  ]

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularMessageField(value: &self._quantity)
      case 2: try decoder.decodeRepeatedMessageField(value: &self.attributes)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if let v = self._quantity {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
    }
    if !self.attributes.isEmpty {
      try visitor.visitRepeatedMessageField(value: self.attributes, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: Akash_Base_V1beta1_Memory, rhs: Akash_Base_V1beta1_Memory) -> Bool {
    if lhs._quantity != rhs._quantity {return false}
    if lhs.attributes != rhs.attributes {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension Akash_Base_V1beta1_Storage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".Storage"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "quantity"),
    2: .same(proto: "attributes"),
  ]

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularMessageField(value: &self._quantity)
      case 2: try decoder.decodeRepeatedMessageField(value: &self.attributes)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if let v = self._quantity {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
    }
    if !self.attributes.isEmpty {
      try visitor.visitRepeatedMessageField(value: self.attributes, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: Akash_Base_V1beta1_Storage, rhs: Akash_Base_V1beta1_Storage) -> Bool {
    if lhs._quantity != rhs._quantity {return false}
    if lhs.attributes != rhs.attributes {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension Akash_Base_V1beta1_ResourceUnits: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".ResourceUnits"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "cpu"),
    2: .same(proto: "memory"),
    3: .same(proto: "storage"),
    4: .same(proto: "endpoints"),
  ]

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularMessageField(value: &self._cpu)
      case 2: try decoder.decodeSingularMessageField(value: &self._memory)
      case 3: try decoder.decodeSingularMessageField(value: &self._storage)
      case 4: try decoder.decodeRepeatedMessageField(value: &self.endpoints)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if let v = self._cpu {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
    }
    if let v = self._memory {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
    }
    if let v = self._storage {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
    }
    if !self.endpoints.isEmpty {
      try visitor.visitRepeatedMessageField(value: self.endpoints, fieldNumber: 4)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: Akash_Base_V1beta1_ResourceUnits, rhs: Akash_Base_V1beta1_ResourceUnits) -> Bool {
    if lhs._cpu != rhs._cpu {return false}
    if lhs._memory != rhs._memory {return false}
    if lhs._storage != rhs._storage {return false}
    if lhs.endpoints != rhs.endpoints {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}
