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

/// Plan specifies information about a planned upgrade and when it should occur.
struct Cosmos_Upgrade_V1beta1_Plan {
  // 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.

  /// Sets the name for the upgrade. This name will be used by the upgraded
  /// version of the software to apply any special "on-upgrade" commands during
  /// the first BeginBlock method after the upgrade is applied. It is also used
  /// to detect whether a software version can handle a given upgrade. If no
  /// upgrade handler with this name has been set in the software, it will be
  /// assumed that the software is out-of-date when the upgrade Time or Height is
  /// reached and the software will exit.
  var name: String = String()

  /// The time after which the upgrade must be performed.
  /// Leave set to its zero value to use a pre-defined Height instead.
  var time: SwiftProtobuf.Google_Protobuf_Timestamp {
    get {return _time ?? SwiftProtobuf.Google_Protobuf_Timestamp()}
    set {_time = newValue}
  }
  /// Returns true if `time` has been explicitly set.
  var hasTime: Bool {return self._time != nil}
  /// Clears the value of `time`. Subsequent reads from it will return its default value.
  mutating func clearTime() {self._time = nil}

  /// The height at which the upgrade must be performed.
  /// Only used if Time is not set.
  var height: Int64 = 0

  /// Any application specific upgrade info to be included on-chain
  /// such as a git commit that validators could automatically upgrade to
  var info: String = String()

  /// IBC-enabled chains can opt-in to including the upgraded client state in its upgrade plan
  /// This will make the chain commit to the correct upgraded (self) client state before the upgrade occurs,
  /// so that connecting chains can verify that the new upgraded client is valid by verifying a proof on the
  /// previous version of the chain.
  /// This will allow IBC connections to persist smoothly across planned chain upgrades
  var upgradedClientState: Google_Protobuf2_Any {
    get {return _upgradedClientState ?? Google_Protobuf2_Any()}
    set {_upgradedClientState = newValue}
  }
  /// Returns true if `upgradedClientState` has been explicitly set.
  var hasUpgradedClientState: Bool {return self._upgradedClientState != nil}
  /// Clears the value of `upgradedClientState`. Subsequent reads from it will return its default value.
  mutating func clearUpgradedClientState() {self._upgradedClientState = nil}

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _time: SwiftProtobuf.Google_Protobuf_Timestamp? = nil
  fileprivate var _upgradedClientState: Google_Protobuf2_Any? = nil
}

/// SoftwareUpgradeProposal is a gov Content type for initiating a software
/// upgrade.
struct Cosmos_Upgrade_V1beta1_SoftwareUpgradeProposal {
  // 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 title: String = String()

  var description_p: String = String()

  var plan: Cosmos_Upgrade_V1beta1_Plan {
    get {return _plan ?? Cosmos_Upgrade_V1beta1_Plan()}
    set {_plan = newValue}
  }
  /// Returns true if `plan` has been explicitly set.
  var hasPlan: Bool {return self._plan != nil}
  /// Clears the value of `plan`. Subsequent reads from it will return its default value.
  mutating func clearPlan() {self._plan = nil}

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _plan: Cosmos_Upgrade_V1beta1_Plan? = nil
}

/// CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software
/// upgrade.
struct Cosmos_Upgrade_V1beta1_CancelSoftwareUpgradeProposal {
  // 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 title: String = String()

  var description_p: String = String()

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}
}

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

fileprivate let _protobuf_package = "cosmos.upgrade.v1beta1"

extension Cosmos_Upgrade_V1beta1_Plan: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".Plan"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "name"),
    2: .same(proto: "time"),
    3: .same(proto: "height"),
    4: .same(proto: "info"),
    5: .standard(proto: "upgraded_client_state"),
  ]

  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.name)
      case 2: try decoder.decodeSingularMessageField(value: &self._time)
      case 3: try decoder.decodeSingularInt64Field(value: &self.height)
      case 4: try decoder.decodeSingularStringField(value: &self.info)
      case 5: try decoder.decodeSingularMessageField(value: &self._upgradedClientState)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.name.isEmpty {
      try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
    }
    if let v = self._time {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
    }
    if self.height != 0 {
      try visitor.visitSingularInt64Field(value: self.height, fieldNumber: 3)
    }
    if !self.info.isEmpty {
      try visitor.visitSingularStringField(value: self.info, fieldNumber: 4)
    }
    if let v = self._upgradedClientState {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: Cosmos_Upgrade_V1beta1_Plan, rhs: Cosmos_Upgrade_V1beta1_Plan) -> Bool {
    if lhs.name != rhs.name {return false}
    if lhs._time != rhs._time {return false}
    if lhs.height != rhs.height {return false}
    if lhs.info != rhs.info {return false}
    if lhs._upgradedClientState != rhs._upgradedClientState {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension Cosmos_Upgrade_V1beta1_SoftwareUpgradeProposal: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".SoftwareUpgradeProposal"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "title"),
    2: .same(proto: "description"),
    3: .same(proto: "plan"),
  ]

  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.title)
      case 2: try decoder.decodeSingularStringField(value: &self.description_p)
      case 3: try decoder.decodeSingularMessageField(value: &self._plan)
      default: break
      }
    }
  }

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

  static func ==(lhs: Cosmos_Upgrade_V1beta1_SoftwareUpgradeProposal, rhs: Cosmos_Upgrade_V1beta1_SoftwareUpgradeProposal) -> Bool {
    if lhs.title != rhs.title {return false}
    if lhs.description_p != rhs.description_p {return false}
    if lhs._plan != rhs._plan {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension Cosmos_Upgrade_V1beta1_CancelSoftwareUpgradeProposal: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".CancelSoftwareUpgradeProposal"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "title"),
    2: .same(proto: "description"),
  ]

  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.title)
      case 2: try decoder.decodeSingularStringField(value: &self.description_p)
      default: break
      }
    }
  }

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

  static func ==(lhs: Cosmos_Upgrade_V1beta1_CancelSoftwareUpgradeProposal, rhs: Cosmos_Upgrade_V1beta1_CancelSoftwareUpgradeProposal) -> Bool {
    if lhs.title != rhs.title {return false}
    if lhs.description_p != rhs.description_p {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}
