// DO NOT EDIT.
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: broker-portfolio-commons.proto
//
// For information on using the generated types, please see the documenation:
//   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
}

enum Ru_Mts_Trading_Broker_Commons_PositionGroup: SwiftProtobuf.Enum {
    typealias RawValue = Int
    case stock // = 0
    case bond // = 1
    case currency // = 2
    case other // = 3
    case UNRECOGNIZED(Int)
    
    init() {
        self = .stock
    }
    
    init?(rawValue: Int) {
        switch rawValue {
        case 0: self = .stock
        case 1: self = .bond
        case 2: self = .currency
        case 3: self = .other
        default: self = .UNRECOGNIZED(rawValue)
        }
    }
    
    var rawValue: Int {
        switch self {
        case .stock: return 0
        case .bond: return 1
        case .currency: return 2
        case .other: return 3
        case .UNRECOGNIZED(let i): return i
        }
    }
    
}

#if swift(>=4.2)

extension Ru_Mts_Trading_Broker_Commons_PositionGroup: CaseIterable {
    // The compiler won't synthesize support with the UNRECOGNIZED case.
    static var allCases: [Ru_Mts_Trading_Broker_Commons_PositionGroup] = [
        .stock,
        .bond,
        .currency,
        .other,
    ]
}

#endif  // swift(>=4.2)

enum Ru_Mts_Trading_Broker_Commons_Period: SwiftProtobuf.Enum {
    typealias RawValue = Int
    case oneDay // = 0
    case oneWeek // = 1
    case oneMonth // = 2
    case threeMonths // = 3
    case oneYear // = 4
    case threeYears // = 5
    case allTime // = 6
    case UNRECOGNIZED(Int)
    
    init() {
        self = .oneDay
    }
    
    init?(rawValue: Int) {
        switch rawValue {
        case 0: self = .oneDay
        case 1: self = .oneWeek
        case 2: self = .oneMonth
        case 3: self = .threeMonths
        case 4: self = .oneYear
        case 5: self = .threeYears
        case 6: self = .allTime
        default: self = .UNRECOGNIZED(rawValue)
        }
    }
    
    var rawValue: Int {
        switch self {
        case .oneDay: return 0
        case .oneWeek: return 1
        case .oneMonth: return 2
        case .threeMonths: return 3
        case .oneYear: return 4
        case .threeYears: return 5
        case .allTime: return 6
        case .UNRECOGNIZED(let i): return i
        }
    }
    
}

#if swift(>=4.2)

extension Ru_Mts_Trading_Broker_Commons_Period: CaseIterable {
    // The compiler won't synthesize support with the UNRECOGNIZED case.
    static var allCases: [Ru_Mts_Trading_Broker_Commons_Period] = [
        .oneDay,
        .oneWeek,
        .oneMonth,
        .threeMonths,
        .oneYear,
        .threeYears,
        .allTime,
    ]
}

#endif  // swift(>=4.2)

enum Ru_Mts_Trading_Broker_Commons_PortfolioStatus: SwiftProtobuf.Enum {
    typealias RawValue = Int
    case exists // = 0
    case error // = 1
    case notExists // = 2
    case UNRECOGNIZED(Int)
    
    init() {
        self = .exists
    }
    
    init?(rawValue: Int) {
        switch rawValue {
        case 0: self = .exists
        case 1: self = .error
        case 2: self = .notExists
        default: self = .UNRECOGNIZED(rawValue)
        }
    }
    
    var rawValue: Int {
        switch self {
        case .exists: return 0
        case .error: return 1
        case .notExists: return 2
        case .UNRECOGNIZED(let i): return i
        }
    }
    
}

#if swift(>=4.2)

extension Ru_Mts_Trading_Broker_Commons_PortfolioStatus: CaseIterable {
    // The compiler won't synthesize support with the UNRECOGNIZED case.
    static var allCases: [Ru_Mts_Trading_Broker_Commons_PortfolioStatus] = [
        .exists,
        .error,
        .notExists,
    ]
}

#endif  // swift(>=4.2)

enum Ru_Mts_Trading_Broker_Commons_PositionLifecycleStage: SwiftProtobuf.Enum {
    typealias RawValue = Int
    
    /// выдана
    case issued // = 0
    
    /// в исполнении
    case inProgress // = 1
    
    /// погашена
    case maturity // = 2
    case UNRECOGNIZED(Int)
    
    init() {
        self = .issued
    }
    
    init?(rawValue: Int) {
        switch rawValue {
        case 0: self = .issued
        case 1: self = .inProgress
        case 2: self = .maturity
        default: self = .UNRECOGNIZED(rawValue)
        }
    }
    
    var rawValue: Int {
        switch self {
        case .issued: return 0
        case .inProgress: return 1
        case .maturity: return 2
        case .UNRECOGNIZED(let i): return i
        }
    }
    
}

#if swift(>=4.2)

extension Ru_Mts_Trading_Broker_Commons_PositionLifecycleStage: CaseIterable {
    // The compiler won't synthesize support with the UNRECOGNIZED case.
    static var allCases: [Ru_Mts_Trading_Broker_Commons_PositionLifecycleStage] = [
        .issued,
        .inProgress,
        .maturity,
    ]
}

#endif  // swift(>=4.2)

struct Ru_Mts_Trading_Broker_Commons_PortfolioResponse {
    // 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 portfolio: Ru_Mts_Trading_Broker_Commons_Portfolio {
        get {return _storage._portfolio ?? Ru_Mts_Trading_Broker_Commons_Portfolio()}
        set {_uniqueStorage()._portfolio = newValue}
    }
    /// Returns true if `portfolio` has been explicitly set.
    var hasPortfolio: Bool {return _storage._portfolio != nil}
    /// Clears the value of `portfolio`. Subsequent reads from it will return its default value.
    mutating func clearPortfolio() {_uniqueStorage()._portfolio = nil}
    
    var positions: [Ru_Mts_Trading_Broker_Commons_Position] {
        get {return _storage._positions}
        set {_uniqueStorage()._positions = newValue}
    }
    
    var status: Ru_Mts_Trading_Broker_Commons_PortfolioStatus {
        get {return _storage._status}
        set {_uniqueStorage()._status = newValue}
    }
    
    var unknownFields = SwiftProtobuf.UnknownStorage()
    
    init() {}
    
    fileprivate var _storage = _StorageClass.defaultInstance
}

struct Ru_Mts_Trading_Broker_Commons_Portfolio {
    // 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 name: String {
        get {return _storage._name}
        set {_uniqueStorage()._name = newValue}
    }
    
    /// цена ликвидации
    var liquidationValue: GrpcStringDecimal {
        get {return _storage._liquidationValue ?? GrpcStringDecimal()}
        set {_uniqueStorage()._liquidationValue = newValue}
    }
    /// Returns true if `liquidationValue` has been explicitly set.
    var hasLiquidationValue: Bool {return _storage._liquidationValue != nil}
    /// Clears the value of `liquidationValue`. Subsequent reads from it will return its default value.
    mutating func clearLiquidationValue() {_uniqueStorage()._liquidationValue = nil}
    
    /// сумма по инмтрументам
    var assetsValue: GrpcStringDecimal {
        get {return _storage._assetsValue ?? GrpcStringDecimal()}
        set {_uniqueStorage()._assetsValue = newValue}
    }
    /// Returns true if `assetsValue` has been explicitly set.
    var hasAssetsValue: Bool {return _storage._assetsValue != nil}
    /// Clears the value of `assetsValue`. Subsequent reads from it will return its default value.
    mutating func clearAssetsValue() {_uniqueStorage()._assetsValue = nil}
    
    /// свободные средства
    var freeValue: GrpcStringDecimal {
        get {return _storage._freeValue ?? GrpcStringDecimal()}
        set {_uniqueStorage()._freeValue = newValue}
    }
    /// Returns true if `freeValue` has been explicitly set.
    var hasFreeValue: Bool {return _storage._freeValue != nil}
    /// Clears the value of `freeValue`. Subsequent reads from it will return its default value.
    mutating func clearFreeValue() {_uniqueStorage()._freeValue = nil}
    
    /// зарезирвированные (заблокированные) средства (freeValue - availableWithdrawAmount)
    var reservedValue: GrpcStringDecimal {
        get {return _storage._reservedValue ?? GrpcStringDecimal()}
        set {_uniqueStorage()._reservedValue = newValue}
    }
    /// Returns true if `reservedValue` has been explicitly set.
    var hasReservedValue: Bool {return _storage._reservedValue != nil}
    /// Clears the value of `reservedValue`. Subsequent reads from it will return its default value.
    mutating func clearReservedValue() {_uniqueStorage()._reservedValue = nil}
    
    /// доходность
    var yield: GrpcStringDecimal {
        get {return _storage._yield ?? GrpcStringDecimal()}
        set {_uniqueStorage()._yield = newValue}
    }
    /// Returns true if `yield` has been explicitly set.
    var hasYield: Bool {return _storage._yield != nil}
    /// Clears the value of `yield`. Subsequent reads from it will return its default value.
    mutating func clearYield() {_uniqueStorage()._yield = nil}
    
    /// доход
    var income: GrpcStringDecimal {
        get {return _storage._income ?? GrpcStringDecimal()}
        set {_uniqueStorage()._income = newValue}
    }
    /// Returns true if `income` has been explicitly set.
    var hasIncome: Bool {return _storage._income != nil}
    /// Clears the value of `income`. Subsequent reads from it will return its default value.
    mutating func clearIncome() {_uniqueStorage()._income = nil}
    
    /// доходность в годовых
    var yieldPerAnnum: GrpcStringDecimal {
        get {return _storage._yieldPerAnnum ?? GrpcStringDecimal()}
        set {_uniqueStorage()._yieldPerAnnum = newValue}
    }
    /// Returns true if `yieldPerAnnum` has been explicitly set.
    var hasYieldPerAnnum: Bool {return _storage._yieldPerAnnum != nil}
    /// Clears the value of `yieldPerAnnum`. Subsequent reads from it will return its default value.
    mutating func clearYieldPerAnnum() {_uniqueStorage()._yieldPerAnnum = nil}
    
    /// номер договора
    var contractID: String {
        get {return _storage._contractID}
        set {_uniqueStorage()._contractID = newValue}
    }
    
    /// сумма доступная к выводу
    var availableWithdrawAmount: GrpcStringDecimal {
        get {return _storage._availableWithdrawAmount ?? GrpcStringDecimal()}
        set {_uniqueStorage()._availableWithdrawAmount = newValue}
    }
    /// Returns true if `availableWithdrawAmount` has been explicitly set.
    var hasAvailableWithdrawAmount: Bool {return _storage._availableWithdrawAmount != nil}
    /// Clears the value of `availableWithdrawAmount`. Subsequent reads from it will return its default value.
    mutating func clearAvailableWithdrawAmount() {_uniqueStorage()._availableWithdrawAmount = nil}
    
    /// Максимальная дата, когда будет разблокировано reservedValue. Опционально, заполняется, только если reservedValue > 0
    var reservedUntil: GrpcOptionalDate {
        get {return _storage._reservedUntil ?? GrpcOptionalDate()}
        set {_uniqueStorage()._reservedUntil = newValue}
    }
    /// Returns true if `reservedUntil` has been explicitly set.
    var hasReservedUntil: Bool {return _storage._reservedUntil != nil}
    /// Clears the value of `reservedUntil`. Subsequent reads from it will return its default value.
    mutating func clearReservedUntil() {_uniqueStorage()._reservedUntil = nil}
    
    var unknownFields = SwiftProtobuf.UnknownStorage()
    
    init() {}
    
    fileprivate var _storage = _StorageClass.defaultInstance
}

struct Ru_Mts_Trading_Broker_Commons_Position {
    // 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 id: String {
        get {return _storage._id}
        set {_uniqueStorage()._id = newValue}
    }
    
    /// идентификатор инструмента
    var name: String {
        get {return _storage._name}
        set {_uniqueStorage()._name = newValue}
    }
    
    /// описание
    var subTitle: String {
        get {return _storage._subTitle}
        set {_uniqueStorage()._subTitle = newValue}
    }
    
    /// сумма
    var amount: GrpcStringDecimal {
        get {return _storage._amount ?? GrpcStringDecimal()}
        set {_uniqueStorage()._amount = newValue}
    }
    /// Returns true if `amount` has been explicitly set.
    var hasAmount: Bool {return _storage._amount != nil}
    /// Clears the value of `amount`. Subsequent reads from it will return its default value.
    mutating func clearAmount() {_uniqueStorage()._amount = nil}
    
    /// средняя цена
    var averagePrice: GrpcStringDecimal {
        get {return _storage._averagePrice ?? GrpcStringDecimal()}
        set {_uniqueStorage()._averagePrice = newValue}
    }
    /// Returns true if `averagePrice` has been explicitly set.
    var hasAveragePrice: Bool {return _storage._averagePrice != nil}
    /// Clears the value of `averagePrice`. Subsequent reads from it will return its default value.
    mutating func clearAveragePrice() {_uniqueStorage()._averagePrice = nil}
    
    /// deprecated
    var quantityInt: GrpcStringInteger {
        get {return _storage._quantityInt ?? GrpcStringInteger()}
        set {_uniqueStorage()._quantityInt = newValue}
    }
    /// Returns true if `quantityInt` has been explicitly set.
    var hasQuantityInt: Bool {return _storage._quantityInt != nil}
    /// Clears the value of `quantityInt`. Subsequent reads from it will return its default value.
    mutating func clearQuantityInt() {_uniqueStorage()._quantityInt = nil}
    
    /// доходность
    var yield: GrpcStringDecimal {
        get {return _storage._yield ?? GrpcStringDecimal()}
        set {_uniqueStorage()._yield = newValue}
    }
    /// Returns true if `yield` has been explicitly set.
    var hasYield: Bool {return _storage._yield != nil}
    /// Clears the value of `yield`. Subsequent reads from it will return its default value.
    mutating func clearYield() {_uniqueStorage()._yield = nil}
    
    /// доход
    var income: GrpcStringDecimal {
        get {return _storage._income ?? GrpcStringDecimal()}
        set {_uniqueStorage()._income = newValue}
    }
    /// Returns true if `income` has been explicitly set.
    var hasIncome: Bool {return _storage._income != nil}
    /// Clears the value of `income`. Subsequent reads from it will return its default value.
    mutating func clearIncome() {_uniqueStorage()._income = nil}
    
    /// доходность в годовых
    var yieldPerAnnum: GrpcStringDecimal {
        get {return _storage._yieldPerAnnum ?? GrpcStringDecimal()}
        set {_uniqueStorage()._yieldPerAnnum = newValue}
    }
    /// Returns true if `yieldPerAnnum` has been explicitly set.
    var hasYieldPerAnnum: Bool {return _storage._yieldPerAnnum != nil}
    /// Clears the value of `yieldPerAnnum`. Subsequent reads from it will return its default value.
    mutating func clearYieldPerAnnum() {_uniqueStorage()._yieldPerAnnum = nil}
    
    /// дата приобретения
    var purchaseDate: SwiftProtobuf.Google_Protobuf_Timestamp {
        get {return _storage._purchaseDate ?? SwiftProtobuf.Google_Protobuf_Timestamp()}
        set {_uniqueStorage()._purchaseDate = newValue}
    }
    /// Returns true if `purchaseDate` has been explicitly set.
    var hasPurchaseDate: Bool {return _storage._purchaseDate != nil}
    /// Clears the value of `purchaseDate`. Subsequent reads from it will return its default value.
    mutating func clearPurchaseDate() {_uniqueStorage()._purchaseDate = nil}
    
    /// отмечен ли как избранный
    var isFavorite: Bool {
        get {return _storage._isFavorite}
        set {_uniqueStorage()._isFavorite = newValue}
    }
    
    /// показатель сортировки
    var sort: GrpcStringInteger {
        get {return _storage._sort ?? GrpcStringInteger()}
        set {_uniqueStorage()._sort = newValue}
    }
    /// Returns true if `sort` has been explicitly set.
    var hasSort: Bool {return _storage._sort != nil}
    /// Clears the value of `sort`. Subsequent reads from it will return its default value.
    mutating func clearSort() {_uniqueStorage()._sort = nil}
    
    /// группа бумаг
    var group: Ru_Mts_Trading_Broker_Commons_PositionGroup {
        get {return _storage._group}
        set {_uniqueStorage()._group = newValue}
    }
    
    /// валют
    var currency: GrpcCurrency {
        get {return _storage._currency ?? GrpcCurrency()}
        set {_uniqueStorage()._currency = newValue}
    }
    /// Returns true if `currency` has been explicitly set.
    var hasCurrency: Bool {return _storage._currency != nil}
    /// Clears the value of `currency`. Subsequent reads from it will return its default value.
    mutating func clearCurrency() {_uniqueStorage()._currency = nil}
    
    /// новый тип бумаги
    var instrumentCommonType: GrpcInstrumentCommonType {
        get {return _storage._instrumentCommonType}
        set {_uniqueStorage()._instrumentCommonType = newValue}
    }
    
    /// дата погашения
    var maturityDate: SwiftProtobuf.Google_Protobuf_Timestamp {
        get {return _storage._maturityDate ?? SwiftProtobuf.Google_Protobuf_Timestamp()}
        set {_uniqueStorage()._maturityDate = newValue}
    }
    /// Returns true if `maturityDate` has been explicitly set.
    var hasMaturityDate: Bool {return _storage._maturityDate != nil}
    /// Clears the value of `maturityDate`. Subsequent reads from it will return its default value.
    mutating func clearMaturityDate() {_uniqueStorage()._maturityDate = nil}
    
    /// погашена ли
    var isMaturity: Bool {
        get {return _storage._isMaturity}
        set {_uniqueStorage()._isMaturity = newValue}
    }
    
    /// сумма в рублях
    var amountRub: GrpcStringDecimal {
        get {return _storage._amountRub ?? GrpcStringDecimal()}
        set {_uniqueStorage()._amountRub = newValue}
    }
    /// Returns true if `amountRub` has been explicitly set.
    var hasAmountRub: Bool {return _storage._amountRub != nil}
    /// Clears the value of `amountRub`. Subsequent reads from it will return its default value.
    mutating func clearAmountRub() {_uniqueStorage()._amountRub = nil}
    
    /// доходность в рублях
    var yieldRub: GrpcStringDecimal {
        get {return _storage._yieldRub ?? GrpcStringDecimal()}
        set {_uniqueStorage()._yieldRub = newValue}
    }
    /// Returns true if `yieldRub` has been explicitly set.
    var hasYieldRub: Bool {return _storage._yieldRub != nil}
    /// Clears the value of `yieldRub`. Subsequent reads from it will return its default value.
    mutating func clearYieldRub() {_uniqueStorage()._yieldRub = nil}
    
    /// доход в рублях
    var incomeRub: GrpcStringDecimal {
        get {return _storage._incomeRub ?? GrpcStringDecimal()}
        set {_uniqueStorage()._incomeRub = newValue}
    }
    /// Returns true if `incomeRub` has been explicitly set.
    var hasIncomeRub: Bool {return _storage._incomeRub != nil}
    /// Clears the value of `incomeRub`. Subsequent reads from it will return its default value.
    mutating func clearIncomeRub() {_uniqueStorage()._incomeRub = nil}
    
    /// доходность в годовых в рублях
    var yieldPerAnnumRub: GrpcStringDecimal {
        get {return _storage._yieldPerAnnumRub ?? GrpcStringDecimal()}
        set {_uniqueStorage()._yieldPerAnnumRub = newValue}
    }
    /// Returns true if `yieldPerAnnumRub` has been explicitly set.
    var hasYieldPerAnnumRub: Bool {return _storage._yieldPerAnnumRub != nil}
    /// Clears the value of `yieldPerAnnumRub`. Subsequent reads from it will return its default value.
    mutating func clearYieldPerAnnumRub() {_uniqueStorage()._yieldPerAnnumRub = nil}
    
    /// количество активов
    var quantity: GrpcStringDecimal {
        get {return _storage._quantity ?? GrpcStringDecimal()}
        set {_uniqueStorage()._quantity = newValue}
    }
    /// Returns true if `quantity` has been explicitly set.
    var hasQuantity: Bool {return _storage._quantity != nil}
    /// Clears the value of `quantity`. Subsequent reads from it will return its default value.
    mutating func clearQuantity() {_uniqueStorage()._quantity = nil}
    
    /// стредства в пути
    var moneyFlowAmount: GrpcStringDecimal {
        get {return _storage._moneyFlowAmount ?? GrpcStringDecimal()}
        set {_uniqueStorage()._moneyFlowAmount = newValue}
    }
    /// Returns true if `moneyFlowAmount` has been explicitly set.
    var hasMoneyFlowAmount: Bool {return _storage._moneyFlowAmount != nil}
    /// Clears the value of `moneyFlowAmount`. Subsequent reads from it will return its default value.
    mutating func clearMoneyFlowAmount() {_uniqueStorage()._moneyFlowAmount = nil}
    
    /// этап жизненного цикла позиции
    var lifecycleStage: Ru_Mts_Trading_Broker_Commons_PositionLifecycleStage {
        get {return _storage._lifecycleStage}
        set {_uniqueStorage()._lifecycleStage = newValue}
    }
    
    var unknownFields = SwiftProtobuf.UnknownStorage()
    
    init() {}
    
    fileprivate var _storage = _StorageClass.defaultInstance
}

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

fileprivate let _protobuf_package = "ru.mts.trading.broker.commons"

extension Ru_Mts_Trading_Broker_Commons_PositionGroup: SwiftProtobuf._ProtoNameProviding {
    static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
        0: .same(proto: "STOCK"),
        1: .same(proto: "BOND"),
        2: .same(proto: "CURRENCY"),
        3: .same(proto: "OTHER"),
    ]
}

extension Ru_Mts_Trading_Broker_Commons_Period: SwiftProtobuf._ProtoNameProviding {
    static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
        0: .same(proto: "ONE_DAY"),
        1: .same(proto: "ONE_WEEK"),
        2: .same(proto: "ONE_MONTH"),
        3: .same(proto: "THREE_MONTHS"),
        4: .same(proto: "ONE_YEAR"),
        5: .same(proto: "THREE_YEARS"),
        6: .same(proto: "ALL_TIME"),
    ]
}

extension Ru_Mts_Trading_Broker_Commons_PortfolioStatus: SwiftProtobuf._ProtoNameProviding {
    static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
        0: .same(proto: "EXISTS"),
        1: .same(proto: "ERROR"),
        2: .same(proto: "NOT_EXISTS"),
    ]
}

extension Ru_Mts_Trading_Broker_Commons_PositionLifecycleStage: SwiftProtobuf._ProtoNameProviding {
    static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
        0: .same(proto: "ISSUED"),
        1: .same(proto: "IN_PROGRESS"),
        2: .same(proto: "MATURITY"),
    ]
}

extension Ru_Mts_Trading_Broker_Commons_PortfolioResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
    static let protoMessageName: String = _protobuf_package + ".PortfolioResponse"
    static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
        1: .same(proto: "portfolio"),
        2: .same(proto: "positions"),
        3: .same(proto: "status"),
    ]
    
    fileprivate class _StorageClass {
        var _portfolio: Ru_Mts_Trading_Broker_Commons_Portfolio? = nil
        var _positions: [Ru_Mts_Trading_Broker_Commons_Position] = []
        var _status: Ru_Mts_Trading_Broker_Commons_PortfolioStatus = .exists
        
        static let defaultInstance = _StorageClass()
        
        private init() {}
        
        init(copying source: _StorageClass) {
            _portfolio = source._portfolio
            _positions = source._positions
            _status = source._status
        }
    }
    
    fileprivate mutating func _uniqueStorage() -> _StorageClass {
        if !isKnownUniquelyReferenced(&_storage) {
            _storage = _StorageClass(copying: _storage)
        }
        return _storage
    }
    
    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: try decoder.decodeSingularMessageField(value: &_storage._portfolio)
                case 2: try decoder.decodeRepeatedMessageField(value: &_storage._positions)
                case 3: try decoder.decodeSingularEnumField(value: &_storage._status)
                default: break
                }
            }
        }
    }
    
    func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
        try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
            if let v = _storage._portfolio {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
            }
            if !_storage._positions.isEmpty {
                try visitor.visitRepeatedMessageField(value: _storage._positions, fieldNumber: 2)
            }
            if _storage._status != .exists {
                try visitor.visitSingularEnumField(value: _storage._status, fieldNumber: 3)
            }
        }
        try unknownFields.traverse(visitor: &visitor)
    }
    
    static func ==(lhs: Ru_Mts_Trading_Broker_Commons_PortfolioResponse, rhs: Ru_Mts_Trading_Broker_Commons_PortfolioResponse) -> 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._portfolio != rhs_storage._portfolio {return false}
                if _storage._positions != rhs_storage._positions {return false}
                if _storage._status != rhs_storage._status {return false}
                return true
            }
            if !storagesAreEqual {return false}
        }
        if lhs.unknownFields != rhs.unknownFields {return false}
        return true
    }
}

extension Ru_Mts_Trading_Broker_Commons_Portfolio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
    static let protoMessageName: String = _protobuf_package + ".Portfolio"
    static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
        1: .same(proto: "name"),
        2: .same(proto: "liquidationValue"),
        3: .same(proto: "assetsValue"),
        4: .same(proto: "freeValue"),
        5: .same(proto: "reservedValue"),
        6: .same(proto: "yield"),
        7: .same(proto: "income"),
        8: .same(proto: "yieldPerAnnum"),
        9: .same(proto: "contractId"),
        10: .same(proto: "availableWithdrawAmount"),
        11: .same(proto: "reservedUntil"),
    ]
    
    fileprivate class _StorageClass {
        var _name: String = String()
        var _liquidationValue: GrpcStringDecimal? = nil
        var _assetsValue: GrpcStringDecimal? = nil
        var _freeValue: GrpcStringDecimal? = nil
        var _reservedValue: GrpcStringDecimal? = nil
        var _yield: GrpcStringDecimal? = nil
        var _income: GrpcStringDecimal? = nil
        var _yieldPerAnnum: GrpcStringDecimal? = nil
        var _contractID: String = String()
        var _availableWithdrawAmount: GrpcStringDecimal? = nil
        var _reservedUntil: GrpcOptionalDate? = nil
        
        static let defaultInstance = _StorageClass()
        
        private init() {}
        
        init(copying source: _StorageClass) {
            _name = source._name
            _liquidationValue = source._liquidationValue
            _assetsValue = source._assetsValue
            _freeValue = source._freeValue
            _reservedValue = source._reservedValue
            _yield = source._yield
            _income = source._income
            _yieldPerAnnum = source._yieldPerAnnum
            _contractID = source._contractID
            _availableWithdrawAmount = source._availableWithdrawAmount
            _reservedUntil = source._reservedUntil
        }
    }
    
    fileprivate mutating func _uniqueStorage() -> _StorageClass {
        if !isKnownUniquelyReferenced(&_storage) {
            _storage = _StorageClass(copying: _storage)
        }
        return _storage
    }
    
    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: try decoder.decodeSingularStringField(value: &_storage._name)
                case 2: try decoder.decodeSingularMessageField(value: &_storage._liquidationValue)
                case 3: try decoder.decodeSingularMessageField(value: &_storage._assetsValue)
                case 4: try decoder.decodeSingularMessageField(value: &_storage._freeValue)
                case 5: try decoder.decodeSingularMessageField(value: &_storage._reservedValue)
                case 6: try decoder.decodeSingularMessageField(value: &_storage._yield)
                case 7: try decoder.decodeSingularMessageField(value: &_storage._income)
                case 8: try decoder.decodeSingularMessageField(value: &_storage._yieldPerAnnum)
                case 9: try decoder.decodeSingularStringField(value: &_storage._contractID)
                case 10: try decoder.decodeSingularMessageField(value: &_storage._availableWithdrawAmount)
                case 11: try decoder.decodeSingularMessageField(value: &_storage._reservedUntil)
                default: break
                }
            }
        }
    }
    
    func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
        try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
            if !_storage._name.isEmpty {
                try visitor.visitSingularStringField(value: _storage._name, fieldNumber: 1)
            }
            if let v = _storage._liquidationValue {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
            }
            if let v = _storage._assetsValue {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
            }
            if let v = _storage._freeValue {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
            }
            if let v = _storage._reservedValue {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
            }
            if let v = _storage._yield {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
            }
            if let v = _storage._income {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
            }
            if let v = _storage._yieldPerAnnum {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
            }
            if !_storage._contractID.isEmpty {
                try visitor.visitSingularStringField(value: _storage._contractID, fieldNumber: 9)
            }
            if let v = _storage._availableWithdrawAmount {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 10)
            }
            if let v = _storage._reservedUntil {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 11)
            }
        }
        try unknownFields.traverse(visitor: &visitor)
    }
    
    static func ==(lhs: Ru_Mts_Trading_Broker_Commons_Portfolio, rhs: Ru_Mts_Trading_Broker_Commons_Portfolio) -> 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._name != rhs_storage._name {return false}
                if _storage._liquidationValue != rhs_storage._liquidationValue {return false}
                if _storage._assetsValue != rhs_storage._assetsValue {return false}
                if _storage._freeValue != rhs_storage._freeValue {return false}
                if _storage._reservedValue != rhs_storage._reservedValue {return false}
                if _storage._yield != rhs_storage._yield {return false}
                if _storage._income != rhs_storage._income {return false}
                if _storage._yieldPerAnnum != rhs_storage._yieldPerAnnum {return false}
                if _storage._contractID != rhs_storage._contractID {return false}
                if _storage._availableWithdrawAmount != rhs_storage._availableWithdrawAmount {return false}
                if _storage._reservedUntil != rhs_storage._reservedUntil {return false}
                return true
            }
            if !storagesAreEqual {return false}
        }
        if lhs.unknownFields != rhs.unknownFields {return false}
        return true
    }
}

extension Ru_Mts_Trading_Broker_Commons_Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
    static let protoMessageName: String = _protobuf_package + ".Position"
    static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
        1: .same(proto: "id"),
        2: .same(proto: "name"),
        3: .same(proto: "subTitle"),
        4: .same(proto: "amount"),
        5: .same(proto: "averagePrice"),
        6: .same(proto: "quantityInt"),
        7: .same(proto: "yield"),
        8: .same(proto: "income"),
        9: .same(proto: "yieldPerAnnum"),
        10: .same(proto: "purchaseDate"),
        11: .same(proto: "isFavorite"),
        12: .same(proto: "sort"),
        13: .same(proto: "group"),
        14: .same(proto: "currency"),
        15: .same(proto: "instrumentCommonType"),
        16: .same(proto: "maturityDate"),
        17: .same(proto: "isMaturity"),
        18: .same(proto: "amountRub"),
        19: .same(proto: "yieldRub"),
        20: .same(proto: "incomeRub"),
        21: .same(proto: "yieldPerAnnumRub"),
        22: .same(proto: "quantity"),
        23: .same(proto: "moneyFlowAmount"),
        24: .same(proto: "lifecycleStage"),
    ]
    
    fileprivate class _StorageClass {
        var _id: String = String()
        var _name: String = String()
        var _subTitle: String = String()
        var _amount: GrpcStringDecimal? = nil
        var _averagePrice: GrpcStringDecimal? = nil
        var _quantityInt: GrpcStringInteger? = nil
        var _yield: GrpcStringDecimal? = nil
        var _income: GrpcStringDecimal? = nil
        var _yieldPerAnnum: GrpcStringDecimal? = nil
        var _purchaseDate: SwiftProtobuf.Google_Protobuf_Timestamp? = nil
        var _isFavorite: Bool = false
        var _sort: GrpcStringInteger? = nil
        var _group: Ru_Mts_Trading_Broker_Commons_PositionGroup = .stock
        var _currency: GrpcCurrency? = nil
        var _instrumentCommonType: GrpcInstrumentCommonType = .other
        var _maturityDate: SwiftProtobuf.Google_Protobuf_Timestamp? = nil
        var _isMaturity: Bool = false
        var _amountRub: GrpcStringDecimal? = nil
        var _yieldRub: GrpcStringDecimal? = nil
        var _incomeRub: GrpcStringDecimal? = nil
        var _yieldPerAnnumRub: GrpcStringDecimal? = nil
        var _quantity: GrpcStringDecimal? = nil
        var _moneyFlowAmount: GrpcStringDecimal? = nil
        var _lifecycleStage: Ru_Mts_Trading_Broker_Commons_PositionLifecycleStage = .issued
        
        static let defaultInstance = _StorageClass()
        
        private init() {}
        
        init(copying source: _StorageClass) {
            _id = source._id
            _name = source._name
            _subTitle = source._subTitle
            _amount = source._amount
            _averagePrice = source._averagePrice
            _quantityInt = source._quantityInt
            _yield = source._yield
            _income = source._income
            _yieldPerAnnum = source._yieldPerAnnum
            _purchaseDate = source._purchaseDate
            _isFavorite = source._isFavorite
            _sort = source._sort
            _group = source._group
            _currency = source._currency
            _instrumentCommonType = source._instrumentCommonType
            _maturityDate = source._maturityDate
            _isMaturity = source._isMaturity
            _amountRub = source._amountRub
            _yieldRub = source._yieldRub
            _incomeRub = source._incomeRub
            _yieldPerAnnumRub = source._yieldPerAnnumRub
            _quantity = source._quantity
            _moneyFlowAmount = source._moneyFlowAmount
            _lifecycleStage = source._lifecycleStage
        }
    }
    
    fileprivate mutating func _uniqueStorage() -> _StorageClass {
        if !isKnownUniquelyReferenced(&_storage) {
            _storage = _StorageClass(copying: _storage)
        }
        return _storage
    }
    
    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: try decoder.decodeSingularStringField(value: &_storage._id)
                case 2: try decoder.decodeSingularStringField(value: &_storage._name)
                case 3: try decoder.decodeSingularStringField(value: &_storage._subTitle)
                case 4: try decoder.decodeSingularMessageField(value: &_storage._amount)
                case 5: try decoder.decodeSingularMessageField(value: &_storage._averagePrice)
                case 6: try decoder.decodeSingularMessageField(value: &_storage._quantityInt)
                case 7: try decoder.decodeSingularMessageField(value: &_storage._yield)
                case 8: try decoder.decodeSingularMessageField(value: &_storage._income)
                case 9: try decoder.decodeSingularMessageField(value: &_storage._yieldPerAnnum)
                case 10: try decoder.decodeSingularMessageField(value: &_storage._purchaseDate)
                case 11: try decoder.decodeSingularBoolField(value: &_storage._isFavorite)
                case 12: try decoder.decodeSingularMessageField(value: &_storage._sort)
                case 13: try decoder.decodeSingularEnumField(value: &_storage._group)
                case 14: try decoder.decodeSingularMessageField(value: &_storage._currency)
                case 15: try decoder.decodeSingularEnumField(value: &_storage._instrumentCommonType)
                case 16: try decoder.decodeSingularMessageField(value: &_storage._maturityDate)
                case 17: try decoder.decodeSingularBoolField(value: &_storage._isMaturity)
                case 18: try decoder.decodeSingularMessageField(value: &_storage._amountRub)
                case 19: try decoder.decodeSingularMessageField(value: &_storage._yieldRub)
                case 20: try decoder.decodeSingularMessageField(value: &_storage._incomeRub)
                case 21: try decoder.decodeSingularMessageField(value: &_storage._yieldPerAnnumRub)
                case 22: try decoder.decodeSingularMessageField(value: &_storage._quantity)
                case 23: try decoder.decodeSingularMessageField(value: &_storage._moneyFlowAmount)
                case 24: try decoder.decodeSingularEnumField(value: &_storage._lifecycleStage)
                default: break
                }
            }
        }
    }
    
    func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
        try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
            if !_storage._id.isEmpty {
                try visitor.visitSingularStringField(value: _storage._id, fieldNumber: 1)
            }
            if !_storage._name.isEmpty {
                try visitor.visitSingularStringField(value: _storage._name, fieldNumber: 2)
            }
            if !_storage._subTitle.isEmpty {
                try visitor.visitSingularStringField(value: _storage._subTitle, fieldNumber: 3)
            }
            if let v = _storage._amount {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
            }
            if let v = _storage._averagePrice {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
            }
            if let v = _storage._quantityInt {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
            }
            if let v = _storage._yield {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
            }
            if let v = _storage._income {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
            }
            if let v = _storage._yieldPerAnnum {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 9)
            }
            if let v = _storage._purchaseDate {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 10)
            }
            if _storage._isFavorite != false {
                try visitor.visitSingularBoolField(value: _storage._isFavorite, fieldNumber: 11)
            }
            if let v = _storage._sort {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 12)
            }
            if _storage._group != .stock {
                try visitor.visitSingularEnumField(value: _storage._group, fieldNumber: 13)
            }
            if let v = _storage._currency {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 14)
            }
            if _storage._instrumentCommonType != .other {
                try visitor.visitSingularEnumField(value: _storage._instrumentCommonType, fieldNumber: 15)
            }
            if let v = _storage._maturityDate {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 16)
            }
            if _storage._isMaturity != false {
                try visitor.visitSingularBoolField(value: _storage._isMaturity, fieldNumber: 17)
            }
            if let v = _storage._amountRub {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 18)
            }
            if let v = _storage._yieldRub {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 19)
            }
            if let v = _storage._incomeRub {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 20)
            }
            if let v = _storage._yieldPerAnnumRub {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 21)
            }
            if let v = _storage._quantity {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 22)
            }
            if let v = _storage._moneyFlowAmount {
                try visitor.visitSingularMessageField(value: v, fieldNumber: 23)
            }
            if _storage._lifecycleStage != .issued {
                try visitor.visitSingularEnumField(value: _storage._lifecycleStage, fieldNumber: 24)
            }
        }
        try unknownFields.traverse(visitor: &visitor)
    }
    
    static func ==(lhs: Ru_Mts_Trading_Broker_Commons_Position, rhs: Ru_Mts_Trading_Broker_Commons_Position) -> 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._id != rhs_storage._id {return false}
                if _storage._name != rhs_storage._name {return false}
                if _storage._subTitle != rhs_storage._subTitle {return false}
                if _storage._amount != rhs_storage._amount {return false}
                if _storage._averagePrice != rhs_storage._averagePrice {return false}
                if _storage._quantityInt != rhs_storage._quantityInt {return false}
                if _storage._yield != rhs_storage._yield {return false}
                if _storage._income != rhs_storage._income {return false}
                if _storage._yieldPerAnnum != rhs_storage._yieldPerAnnum {return false}
                if _storage._purchaseDate != rhs_storage._purchaseDate {return false}
                if _storage._isFavorite != rhs_storage._isFavorite {return false}
                if _storage._sort != rhs_storage._sort {return false}
                if _storage._group != rhs_storage._group {return false}
                if _storage._currency != rhs_storage._currency {return false}
                if _storage._instrumentCommonType != rhs_storage._instrumentCommonType {return false}
                if _storage._maturityDate != rhs_storage._maturityDate {return false}
                if _storage._isMaturity != rhs_storage._isMaturity {return false}
                if _storage._amountRub != rhs_storage._amountRub {return false}
                if _storage._yieldRub != rhs_storage._yieldRub {return false}
                if _storage._incomeRub != rhs_storage._incomeRub {return false}
                if _storage._yieldPerAnnumRub != rhs_storage._yieldPerAnnumRub {return false}
                if _storage._quantity != rhs_storage._quantity {return false}
                if _storage._moneyFlowAmount != rhs_storage._moneyFlowAmount {return false}
                if _storage._lifecycleStage != rhs_storage._lifecycleStage {return false}
                return true
            }
            if !storagesAreEqual {return false}
        }
        if lhs.unknownFields != rhs.unknownFields {return false}
        return true
    }
}
