// DO NOT EDIT.
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: Solana.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 your 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
}

public struct TW_Solana_Proto_Transfer {
  // 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.

  public var recipient: String = String()

  public var value: UInt64 = 0

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public init() {}
}

public struct TW_Solana_Proto_Stake {
  // 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.

  public var validatorPubkey: String = String()

  public var value: UInt64 = 0

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public init() {}
}

public struct TW_Solana_Proto_DeactivateStake {
  // 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.

  public var validatorPubkey: String = String()

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public init() {}
}

public struct TW_Solana_Proto_WithdrawStake {
  // 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.

  public var validatorPubkey: String = String()

  public var value: UInt64 = 0

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public init() {}
}

/// Input data necessary to create a signed transaction.
public struct TW_Solana_Proto_SigningInput {
  // 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.

  public var transactionType: OneOf_TransactionType? {
    get {return _storage._transactionType}
    set {_uniqueStorage()._transactionType = newValue}
  }

  public var transferTransaction: TW_Solana_Proto_Transfer {
    get {
      if case .transferTransaction(let v)? = _storage._transactionType {return v}
      return TW_Solana_Proto_Transfer()
    }
    set {_uniqueStorage()._transactionType = .transferTransaction(newValue)}
  }

  public var stakeTransaction: TW_Solana_Proto_Stake {
    get {
      if case .stakeTransaction(let v)? = _storage._transactionType {return v}
      return TW_Solana_Proto_Stake()
    }
    set {_uniqueStorage()._transactionType = .stakeTransaction(newValue)}
  }

  public var deactivateStakeTransaction: TW_Solana_Proto_DeactivateStake {
    get {
      if case .deactivateStakeTransaction(let v)? = _storage._transactionType {return v}
      return TW_Solana_Proto_DeactivateStake()
    }
    set {_uniqueStorage()._transactionType = .deactivateStakeTransaction(newValue)}
  }

  public var withdrawTransaction: TW_Solana_Proto_WithdrawStake {
    get {
      if case .withdrawTransaction(let v)? = _storage._transactionType {return v}
      return TW_Solana_Proto_WithdrawStake()
    }
    set {_uniqueStorage()._transactionType = .withdrawTransaction(newValue)}
  }

  public var privateKey: Data {
    get {return _storage._privateKey}
    set {_uniqueStorage()._privateKey = newValue}
  }

  public var recentBlockhash: String {
    get {return _storage._recentBlockhash}
    set {_uniqueStorage()._recentBlockhash = newValue}
  }

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public enum OneOf_TransactionType: Equatable {
    case transferTransaction(TW_Solana_Proto_Transfer)
    case stakeTransaction(TW_Solana_Proto_Stake)
    case deactivateStakeTransaction(TW_Solana_Proto_DeactivateStake)
    case withdrawTransaction(TW_Solana_Proto_WithdrawStake)

  #if !swift(>=4.1)
    public static func ==(lhs: TW_Solana_Proto_SigningInput.OneOf_TransactionType, rhs: TW_Solana_Proto_SigningInput.OneOf_TransactionType) -> Bool {
      switch (lhs, rhs) {
      case (.transferTransaction(let l), .transferTransaction(let r)): return l == r
      case (.stakeTransaction(let l), .stakeTransaction(let r)): return l == r
      case (.deactivateStakeTransaction(let l), .deactivateStakeTransaction(let r)): return l == r
      case (.withdrawTransaction(let l), .withdrawTransaction(let r)): return l == r
      default: return false
      }
    }
  #endif
  }

  public init() {}

  fileprivate var _storage = _StorageClass.defaultInstance
}

/// Transaction signing output.
public struct TW_Solana_Proto_SigningOutput {
  // 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.

  public var encoded: Data = SwiftProtobuf.Internal.emptyData

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public init() {}
}

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

fileprivate let _protobuf_package = "TW.Solana.Proto"

extension TW_Solana_Proto_Transfer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let protoMessageName: String = _protobuf_package + ".Transfer"
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "recipient"),
    2: .same(proto: "value"),
  ]

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

  public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.recipient.isEmpty {
      try visitor.visitSingularStringField(value: self.recipient, fieldNumber: 1)
    }
    if self.value != 0 {
      try visitor.visitSingularUInt64Field(value: self.value, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  public static func ==(lhs: TW_Solana_Proto_Transfer, rhs: TW_Solana_Proto_Transfer) -> Bool {
    if lhs.recipient != rhs.recipient {return false}
    if lhs.value != rhs.value {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension TW_Solana_Proto_Stake: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let protoMessageName: String = _protobuf_package + ".Stake"
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .standard(proto: "validator_pubkey"),
    2: .same(proto: "value"),
  ]

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

  public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.validatorPubkey.isEmpty {
      try visitor.visitSingularStringField(value: self.validatorPubkey, fieldNumber: 1)
    }
    if self.value != 0 {
      try visitor.visitSingularUInt64Field(value: self.value, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  public static func ==(lhs: TW_Solana_Proto_Stake, rhs: TW_Solana_Proto_Stake) -> Bool {
    if lhs.validatorPubkey != rhs.validatorPubkey {return false}
    if lhs.value != rhs.value {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension TW_Solana_Proto_DeactivateStake: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let protoMessageName: String = _protobuf_package + ".DeactivateStake"
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .standard(proto: "validator_pubkey"),
  ]

  public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularStringField(value: &self.validatorPubkey)
      default: break
      }
    }
  }

  public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.validatorPubkey.isEmpty {
      try visitor.visitSingularStringField(value: self.validatorPubkey, fieldNumber: 1)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  public static func ==(lhs: TW_Solana_Proto_DeactivateStake, rhs: TW_Solana_Proto_DeactivateStake) -> Bool {
    if lhs.validatorPubkey != rhs.validatorPubkey {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension TW_Solana_Proto_WithdrawStake: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let protoMessageName: String = _protobuf_package + ".WithdrawStake"
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .standard(proto: "validator_pubkey"),
    2: .same(proto: "value"),
  ]

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

  public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.validatorPubkey.isEmpty {
      try visitor.visitSingularStringField(value: self.validatorPubkey, fieldNumber: 1)
    }
    if self.value != 0 {
      try visitor.visitSingularUInt64Field(value: self.value, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  public static func ==(lhs: TW_Solana_Proto_WithdrawStake, rhs: TW_Solana_Proto_WithdrawStake) -> Bool {
    if lhs.validatorPubkey != rhs.validatorPubkey {return false}
    if lhs.value != rhs.value {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension TW_Solana_Proto_SigningInput: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let protoMessageName: String = _protobuf_package + ".SigningInput"
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .standard(proto: "transfer_transaction"),
    2: .standard(proto: "stake_transaction"),
    3: .standard(proto: "deactivate_stake_transaction"),
    4: .standard(proto: "withdraw_transaction"),
    5: .standard(proto: "private_key"),
    6: .standard(proto: "recent_blockhash"),
  ]

  fileprivate class _StorageClass {
    var _transactionType: TW_Solana_Proto_SigningInput.OneOf_TransactionType?
    var _privateKey: Data = SwiftProtobuf.Internal.emptyData
    var _recentBlockhash: String = String()

    static let defaultInstance = _StorageClass()

    private init() {}

    init(copying source: _StorageClass) {
      _transactionType = source._transactionType
      _privateKey = source._privateKey
      _recentBlockhash = source._recentBlockhash
    }
  }

  fileprivate mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _StorageClass(copying: _storage)
    }
    return _storage
  }

  public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    _ = _uniqueStorage()
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      while let fieldNumber = try decoder.nextFieldNumber() {
        switch fieldNumber {
        case 1:
          var v: TW_Solana_Proto_Transfer?
          if let current = _storage._transactionType {
            try decoder.handleConflictingOneOf()
            if case .transferTransaction(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._transactionType = .transferTransaction(v)}
        case 2:
          var v: TW_Solana_Proto_Stake?
          if let current = _storage._transactionType {
            try decoder.handleConflictingOneOf()
            if case .stakeTransaction(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._transactionType = .stakeTransaction(v)}
        case 3:
          var v: TW_Solana_Proto_DeactivateStake?
          if let current = _storage._transactionType {
            try decoder.handleConflictingOneOf()
            if case .deactivateStakeTransaction(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._transactionType = .deactivateStakeTransaction(v)}
        case 4:
          var v: TW_Solana_Proto_WithdrawStake?
          if let current = _storage._transactionType {
            try decoder.handleConflictingOneOf()
            if case .withdrawTransaction(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._transactionType = .withdrawTransaction(v)}
        case 5: try decoder.decodeSingularBytesField(value: &_storage._privateKey)
        case 6: try decoder.decodeSingularStringField(value: &_storage._recentBlockhash)
        default: break
        }
      }
    }
  }

  public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      switch _storage._transactionType {
      case .transferTransaction(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
      case .stakeTransaction(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
      case .deactivateStakeTransaction(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
      case .withdrawTransaction(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
      case nil: break
      }
      if !_storage._privateKey.isEmpty {
        try visitor.visitSingularBytesField(value: _storage._privateKey, fieldNumber: 5)
      }
      if !_storage._recentBlockhash.isEmpty {
        try visitor.visitSingularStringField(value: _storage._recentBlockhash, fieldNumber: 6)
      }
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  public static func ==(lhs: TW_Solana_Proto_SigningInput, rhs: TW_Solana_Proto_SigningInput) -> Bool {
    if lhs._storage !== rhs._storage {
      let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
        let _storage = _args.0
        let rhs_storage = _args.1
        if _storage._transactionType != rhs_storage._transactionType {return false}
        if _storage._privateKey != rhs_storage._privateKey {return false}
        if _storage._recentBlockhash != rhs_storage._recentBlockhash {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension TW_Solana_Proto_SigningOutput: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let protoMessageName: String = _protobuf_package + ".SigningOutput"
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "encoded"),
  ]

  public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularBytesField(value: &self.encoded)
      default: break
      }
    }
  }

  public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.encoded.isEmpty {
      try visitor.visitSingularBytesField(value: self.encoded, fieldNumber: 1)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  public static func ==(lhs: TW_Solana_Proto_SigningOutput, rhs: TW_Solana_Proto_SigningOutput) -> Bool {
    if lhs.encoded != rhs.encoded {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}
