// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: internal/v2/presence_tracing_parameters.proto
//
// For information on using the generated types, please see the documentation:
//   https://github.com/apple/swift-protobuf/

/// This file is auto-generated, DO NOT make any changes here

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 SAP_Internal_V2_PresenceTracingParameters {
  // 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 riskCalculationParameters: SAP_Internal_V2_PresenceTracingRiskCalculationParameters {
    get {return _riskCalculationParameters ?? SAP_Internal_V2_PresenceTracingRiskCalculationParameters()}
    set {_riskCalculationParameters = newValue}
  }
  /// Returns true if `riskCalculationParameters` has been explicitly set.
  var hasRiskCalculationParameters: Bool {return self._riskCalculationParameters != nil}
  /// Clears the value of `riskCalculationParameters`. Subsequent reads from it will return its default value.
  mutating func clearRiskCalculationParameters() {self._riskCalculationParameters = nil}

  var submissionParameters: SAP_Internal_V2_PresenceTracingSubmissionParameters {
    get {return _submissionParameters ?? SAP_Internal_V2_PresenceTracingSubmissionParameters()}
    set {_submissionParameters = newValue}
  }
  /// Returns true if `submissionParameters` has been explicitly set.
  var hasSubmissionParameters: Bool {return self._submissionParameters != nil}
  /// Clears the value of `submissionParameters`. Subsequent reads from it will return its default value.
  mutating func clearSubmissionParameters() {self._submissionParameters = nil}

  var qrCodeErrorCorrectionLevel: SAP_Internal_V2_PresenceTracingParameters.QRCodeErrorCorrectionLevel = .medium

  var revokedTraceLocationVersions: [UInt32] = []

  var unknownFields = SwiftProtobuf.UnknownStorage()

  enum QRCodeErrorCorrectionLevel: SwiftProtobuf.Enum {
    typealias RawValue = Int
    case medium // = 0
    case low // = 1
    case quantile // = 2
    case high // = 3
    case UNRECOGNIZED(Int)

    init() {
      self = .medium
    }

    init?(rawValue: Int) {
      switch rawValue {
      case 0: self = .medium
      case 1: self = .low
      case 2: self = .quantile
      case 3: self = .high
      default: self = .UNRECOGNIZED(rawValue)
      }
    }

    var rawValue: Int {
      switch self {
      case .medium: return 0
      case .low: return 1
      case .quantile: return 2
      case .high: return 3
      case .UNRECOGNIZED(let i): return i
      }
    }

  }

  init() {}

  fileprivate var _riskCalculationParameters: SAP_Internal_V2_PresenceTracingRiskCalculationParameters? = nil
  fileprivate var _submissionParameters: SAP_Internal_V2_PresenceTracingSubmissionParameters? = nil
}

#if swift(>=4.2)

extension SAP_Internal_V2_PresenceTracingParameters.QRCodeErrorCorrectionLevel: CaseIterable {
  // The compiler won't synthesize support with the UNRECOGNIZED case.
  static var allCases: [SAP_Internal_V2_PresenceTracingParameters.QRCodeErrorCorrectionLevel] = [
    .medium,
    .low,
    .quantile,
    .high,
  ]
}

#endif  // swift(>=4.2)

struct SAP_Internal_V2_PresenceTracingRiskCalculationParameters {
  // 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 transmissionRiskValueMapping: [SAP_Internal_V2_TransmissionRiskValueMapping] = []

  var normalizedTimePerCheckInToRiskLevelMapping: [SAP_Internal_V2_NormalizedTimeToRiskLevelMapping] = []

  var normalizedTimePerDayToRiskLevelMapping: [SAP_Internal_V2_NormalizedTimeToRiskLevelMapping] = []

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}
}

struct SAP_Internal_V2_PresenceTracingSubmissionParameters {
  // 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 durationFilters: [SAP_Internal_V2_PresenceTracingSubmissionParameters.DurationFilter] = []

  var aerosoleDecayLinearFunctions: [SAP_Internal_V2_PresenceTracingSubmissionParameters.AerosoleDecayFunctionLinear] = []

  var unknownFields = SwiftProtobuf.UnknownStorage()

  struct DurationFilter {
    // 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 dropIfMinutesInRange: SAP_Internal_V2_Range {
      get {return _dropIfMinutesInRange ?? SAP_Internal_V2_Range()}
      set {_dropIfMinutesInRange = newValue}
    }
    /// Returns true if `dropIfMinutesInRange` has been explicitly set.
    var hasDropIfMinutesInRange: Bool {return self._dropIfMinutesInRange != nil}
    /// Clears the value of `dropIfMinutesInRange`. Subsequent reads from it will return its default value.
    mutating func clearDropIfMinutesInRange() {self._dropIfMinutesInRange = nil}

    var unknownFields = SwiftProtobuf.UnknownStorage()

    init() {}

    fileprivate var _dropIfMinutesInRange: SAP_Internal_V2_Range? = nil
  }

  struct AerosoleDecayFunctionLinear {
    // 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 minutesRange: SAP_Internal_V2_Range {
      get {return _minutesRange ?? SAP_Internal_V2_Range()}
      set {_minutesRange = newValue}
    }
    /// Returns true if `minutesRange` has been explicitly set.
    var hasMinutesRange: Bool {return self._minutesRange != nil}
    /// Clears the value of `minutesRange`. Subsequent reads from it will return its default value.
    mutating func clearMinutesRange() {self._minutesRange = nil}

    var slope: Double = 0

    var intercept: Double = 0

    var unknownFields = SwiftProtobuf.UnknownStorage()

    init() {}

    fileprivate var _minutesRange: SAP_Internal_V2_Range? = nil
  }

  init() {}
}

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

fileprivate let _protobuf_package = "SAP.internal.v2"

extension SAP_Internal_V2_PresenceTracingParameters: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".PresenceTracingParameters"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "riskCalculationParameters"),
    2: .same(proto: "submissionParameters"),
    3: .same(proto: "qrCodeErrorCorrectionLevel"),
    4: .same(proto: "revokedTraceLocationVersions"),
  ]

  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.decodeSingularMessageField(value: &self._riskCalculationParameters) }()
      case 2: try { try decoder.decodeSingularMessageField(value: &self._submissionParameters) }()
      case 3: try { try decoder.decodeSingularEnumField(value: &self.qrCodeErrorCorrectionLevel) }()
      case 4: try { try decoder.decodeRepeatedUInt32Field(value: &self.revokedTraceLocationVersions) }()
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if let v = self._riskCalculationParameters {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
    }
    if let v = self._submissionParameters {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
    }
    if self.qrCodeErrorCorrectionLevel != .medium {
      try visitor.visitSingularEnumField(value: self.qrCodeErrorCorrectionLevel, fieldNumber: 3)
    }
    if !self.revokedTraceLocationVersions.isEmpty {
      try visitor.visitPackedUInt32Field(value: self.revokedTraceLocationVersions, fieldNumber: 4)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: SAP_Internal_V2_PresenceTracingParameters, rhs: SAP_Internal_V2_PresenceTracingParameters) -> Bool {
    if lhs._riskCalculationParameters != rhs._riskCalculationParameters {return false}
    if lhs._submissionParameters != rhs._submissionParameters {return false}
    if lhs.qrCodeErrorCorrectionLevel != rhs.qrCodeErrorCorrectionLevel {return false}
    if lhs.revokedTraceLocationVersions != rhs.revokedTraceLocationVersions {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension SAP_Internal_V2_PresenceTracingParameters.QRCodeErrorCorrectionLevel: SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    0: .same(proto: "MEDIUM"),
    1: .same(proto: "LOW"),
    2: .same(proto: "QUANTILE"),
    3: .same(proto: "HIGH"),
  ]
}

extension SAP_Internal_V2_PresenceTracingRiskCalculationParameters: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".PresenceTracingRiskCalculationParameters"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "transmissionRiskValueMapping"),
    2: .same(proto: "normalizedTimePerCheckInToRiskLevelMapping"),
    3: .same(proto: "normalizedTimePerDayToRiskLevelMapping"),
  ]

  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.decodeRepeatedMessageField(value: &self.transmissionRiskValueMapping) }()
      case 2: try { try decoder.decodeRepeatedMessageField(value: &self.normalizedTimePerCheckInToRiskLevelMapping) }()
      case 3: try { try decoder.decodeRepeatedMessageField(value: &self.normalizedTimePerDayToRiskLevelMapping) }()
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.transmissionRiskValueMapping.isEmpty {
      try visitor.visitRepeatedMessageField(value: self.transmissionRiskValueMapping, fieldNumber: 1)
    }
    if !self.normalizedTimePerCheckInToRiskLevelMapping.isEmpty {
      try visitor.visitRepeatedMessageField(value: self.normalizedTimePerCheckInToRiskLevelMapping, fieldNumber: 2)
    }
    if !self.normalizedTimePerDayToRiskLevelMapping.isEmpty {
      try visitor.visitRepeatedMessageField(value: self.normalizedTimePerDayToRiskLevelMapping, fieldNumber: 3)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: SAP_Internal_V2_PresenceTracingRiskCalculationParameters, rhs: SAP_Internal_V2_PresenceTracingRiskCalculationParameters) -> Bool {
    if lhs.transmissionRiskValueMapping != rhs.transmissionRiskValueMapping {return false}
    if lhs.normalizedTimePerCheckInToRiskLevelMapping != rhs.normalizedTimePerCheckInToRiskLevelMapping {return false}
    if lhs.normalizedTimePerDayToRiskLevelMapping != rhs.normalizedTimePerDayToRiskLevelMapping {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension SAP_Internal_V2_PresenceTracingSubmissionParameters: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".PresenceTracingSubmissionParameters"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "durationFilters"),
    2: .same(proto: "aerosoleDecayLinearFunctions"),
  ]

  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.decodeRepeatedMessageField(value: &self.durationFilters) }()
      case 2: try { try decoder.decodeRepeatedMessageField(value: &self.aerosoleDecayLinearFunctions) }()
      default: break
      }
    }
  }

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

  static func ==(lhs: SAP_Internal_V2_PresenceTracingSubmissionParameters, rhs: SAP_Internal_V2_PresenceTracingSubmissionParameters) -> Bool {
    if lhs.durationFilters != rhs.durationFilters {return false}
    if lhs.aerosoleDecayLinearFunctions != rhs.aerosoleDecayLinearFunctions {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension SAP_Internal_V2_PresenceTracingSubmissionParameters.DurationFilter: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = SAP_Internal_V2_PresenceTracingSubmissionParameters.protoMessageName + ".DurationFilter"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "dropIfMinutesInRange"),
  ]

  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.decodeSingularMessageField(value: &self._dropIfMinutesInRange) }()
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if let v = self._dropIfMinutesInRange {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: SAP_Internal_V2_PresenceTracingSubmissionParameters.DurationFilter, rhs: SAP_Internal_V2_PresenceTracingSubmissionParameters.DurationFilter) -> Bool {
    if lhs._dropIfMinutesInRange != rhs._dropIfMinutesInRange {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension SAP_Internal_V2_PresenceTracingSubmissionParameters.AerosoleDecayFunctionLinear: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = SAP_Internal_V2_PresenceTracingSubmissionParameters.protoMessageName + ".AerosoleDecayFunctionLinear"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "minutesRange"),
    2: .same(proto: "slope"),
    3: .same(proto: "intercept"),
  ]

  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.decodeSingularMessageField(value: &self._minutesRange) }()
      case 2: try { try decoder.decodeSingularDoubleField(value: &self.slope) }()
      case 3: try { try decoder.decodeSingularDoubleField(value: &self.intercept) }()
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if let v = self._minutesRange {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
    }
    if self.slope != 0 {
      try visitor.visitSingularDoubleField(value: self.slope, fieldNumber: 2)
    }
    if self.intercept != 0 {
      try visitor.visitSingularDoubleField(value: self.intercept, fieldNumber: 3)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: SAP_Internal_V2_PresenceTracingSubmissionParameters.AerosoleDecayFunctionLinear, rhs: SAP_Internal_V2_PresenceTracingSubmissionParameters.AerosoleDecayFunctionLinear) -> Bool {
    if lhs._minutesRange != rhs._minutesRange {return false}
    if lhs.slope != rhs.slope {return false}
    if lhs.intercept != rhs.intercept {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}
