// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: TransactionContents.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
}

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

  /// TransactionBody serialized into bytes, which needs to be signed
  public var bodyBytes: Data = Data()

  /// The signatures on the body with the new format, to authorize the transaction
  public var sigMap: Proto_SignatureMap {
    get {return _sigMap ?? Proto_SignatureMap()}
    set {_sigMap = newValue}
  }
  /// Returns true if `sigMap` has been explicitly set.
  public var hasSigMap: Bool {return self._sigMap != nil}
  /// Clears the value of `sigMap`. Subsequent reads from it will return its default value.
  public mutating func clearSigMap() {self._sigMap = nil}

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public init() {}

  fileprivate var _sigMap: Proto_SignatureMap? = nil
}

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

fileprivate let _protobuf_package = "proto"

extension Proto_SignedTransaction: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let protoMessageName: String = _protobuf_package + ".SignedTransaction"
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "bodyBytes"),
    2: .same(proto: "sigMap"),
  ]

  public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      // The use of inline closures is to circumvent an issue where the compiler
      // allocates stack space for every case branch when no optimizations are
      // enabled. https://github.com/apple/swift-protobuf/issues/1034
      switch fieldNumber {
      case 1: try { try decoder.decodeSingularBytesField(value: &self.bodyBytes) }()
      case 2: try { try decoder.decodeSingularMessageField(value: &self._sigMap) }()
      default: break
      }
    }
  }

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

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