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

struct Bucketeer_Feature_Evaluation {
  // 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 = String()

  var featureID: String = String()

  var featureVersion: Int32 = 0

  var userID: String = String()

  var variationID: String = String()

  var variation: Bucketeer_Feature_Variation {
    get {return _variation ?? Bucketeer_Feature_Variation()}
    set {_variation = newValue}
  }
  /// Returns true if `variation` has been explicitly set.
  var hasVariation: Bool {return self._variation != nil}
  /// Clears the value of `variation`. Subsequent reads from it will return its default value.
  mutating func clearVariation() {self._variation = nil}

  var reason: Bucketeer_Feature_Reason {
    get {return _reason ?? Bucketeer_Feature_Reason()}
    set {_reason = newValue}
  }
  /// Returns true if `reason` has been explicitly set.
  var hasReason: Bool {return self._reason != nil}
  /// Clears the value of `reason`. Subsequent reads from it will return its default value.
  mutating func clearReason() {self._reason = nil}

  var variationValue: String = String()

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _variation: Bucketeer_Feature_Variation? = nil
  fileprivate var _reason: Bucketeer_Feature_Reason? = nil
}

struct Bucketeer_Feature_UserEvaluations {
  // 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 = String()

  var evaluations: [Bucketeer_Feature_Evaluation] = []

  var createdAt: Int64 = 0

  var unknownFields = SwiftProtobuf.UnknownStorage()

  enum State: SwiftProtobuf.Enum {
    typealias RawValue = Int
    case queued // = 0
    case partial // = 1
    case full // = 2
    case UNRECOGNIZED(Int)

    init() {
      self = .queued
    }

    init?(rawValue: Int) {
      switch rawValue {
      case 0: self = .queued
      case 1: self = .partial
      case 2: self = .full
      default: self = .UNRECOGNIZED(rawValue)
      }
    }

    var rawValue: Int {
      switch self {
      case .queued: return 0
      case .partial: return 1
      case .full: return 2
      case .UNRECOGNIZED(let i): return i
      }
    }

  }

  init() {}
}

#if swift(>=4.2)

extension Bucketeer_Feature_UserEvaluations.State: CaseIterable {
  // The compiler won't synthesize support with the UNRECOGNIZED case.
  static var allCases: [Bucketeer_Feature_UserEvaluations.State] = [
    .queued,
    .partial,
    .full,
  ]
}

#endif  // swift(>=4.2)

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

fileprivate let _protobuf_package = "bucketeer.feature"

extension Bucketeer_Feature_Evaluation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".Evaluation"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "id"),
    2: .standard(proto: "feature_id"),
    3: .standard(proto: "feature_version"),
    4: .standard(proto: "user_id"),
    5: .standard(proto: "variation_id"),
    6: .same(proto: "variation"),
    7: .same(proto: "reason"),
    8: .standard(proto: "variation_value"),
  ]

  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.id)
      case 2: try decoder.decodeSingularStringField(value: &self.featureID)
      case 3: try decoder.decodeSingularInt32Field(value: &self.featureVersion)
      case 4: try decoder.decodeSingularStringField(value: &self.userID)
      case 5: try decoder.decodeSingularStringField(value: &self.variationID)
      case 6: try decoder.decodeSingularMessageField(value: &self._variation)
      case 7: try decoder.decodeSingularMessageField(value: &self._reason)
      case 8: try decoder.decodeSingularStringField(value: &self.variationValue)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.id.isEmpty {
      try visitor.visitSingularStringField(value: self.id, fieldNumber: 1)
    }
    if !self.featureID.isEmpty {
      try visitor.visitSingularStringField(value: self.featureID, fieldNumber: 2)
    }
    if self.featureVersion != 0 {
      try visitor.visitSingularInt32Field(value: self.featureVersion, fieldNumber: 3)
    }
    if !self.userID.isEmpty {
      try visitor.visitSingularStringField(value: self.userID, fieldNumber: 4)
    }
    if !self.variationID.isEmpty {
      try visitor.visitSingularStringField(value: self.variationID, fieldNumber: 5)
    }
    if let v = self._variation {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
    }
    if let v = self._reason {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
    }
    if !self.variationValue.isEmpty {
      try visitor.visitSingularStringField(value: self.variationValue, fieldNumber: 8)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: Bucketeer_Feature_Evaluation, rhs: Bucketeer_Feature_Evaluation) -> Bool {
    if lhs.id != rhs.id {return false}
    if lhs.featureID != rhs.featureID {return false}
    if lhs.featureVersion != rhs.featureVersion {return false}
    if lhs.userID != rhs.userID {return false}
    if lhs.variationID != rhs.variationID {return false}
    if lhs._variation != rhs._variation {return false}
    if lhs._reason != rhs._reason {return false}
    if lhs.variationValue != rhs.variationValue {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension Bucketeer_Feature_UserEvaluations: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".UserEvaluations"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "id"),
    2: .same(proto: "evaluations"),
    3: .standard(proto: "created_at"),
  ]

  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.id)
      case 2: try decoder.decodeRepeatedMessageField(value: &self.evaluations)
      case 3: try decoder.decodeSingularInt64Field(value: &self.createdAt)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.id.isEmpty {
      try visitor.visitSingularStringField(value: self.id, fieldNumber: 1)
    }
    if !self.evaluations.isEmpty {
      try visitor.visitRepeatedMessageField(value: self.evaluations, fieldNumber: 2)
    }
    if self.createdAt != 0 {
      try visitor.visitSingularInt64Field(value: self.createdAt, fieldNumber: 3)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: Bucketeer_Feature_UserEvaluations, rhs: Bucketeer_Feature_UserEvaluations) -> Bool {
    if lhs.id != rhs.id {return false}
    if lhs.evaluations != rhs.evaluations {return false}
    if lhs.createdAt != rhs.createdAt {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension Bucketeer_Feature_UserEvaluations.State: SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    0: .same(proto: "QUEUED"),
    1: .same(proto: "PARTIAL"),
    2: .same(proto: "FULL"),
  ]
}
