// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: proto/passwordless_auth_payloads.proto

#include "proto/passwordless_auth_payloads.pb.h"

#include <algorithm>

#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>

PROTOBUF_PRAGMA_INIT_SEG
namespace securegcm {
constexpr IdentityAssertion::IdentityAssertion(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : browser_data_hash_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
  , counter_(int64_t{0})
  , user_approval_(0){}
struct IdentityAssertionDefaultTypeInternal {
  constexpr IdentityAssertionDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~IdentityAssertionDefaultTypeInternal() {}
  union {
    IdentityAssertion _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT IdentityAssertionDefaultTypeInternal _IdentityAssertion_default_instance_;
}  // namespace securegcm
namespace securegcm {

// ===================================================================

class IdentityAssertion::_Internal {
 public:
  using HasBits = decltype(std::declval<IdentityAssertion>()._has_bits_);
  static void set_has_browser_data_hash(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_counter(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_user_approval(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
};

IdentityAssertion::IdentityAssertion(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:securegcm.IdentityAssertion)
}
IdentityAssertion::IdentityAssertion(const IdentityAssertion& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  browser_data_hash_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    browser_data_hash_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_browser_data_hash()) {
    browser_data_hash_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_browser_data_hash(), 
      GetArenaForAllocation());
  }
  ::memcpy(&counter_, &from.counter_,
    static_cast<size_t>(reinterpret_cast<char*>(&user_approval_) -
    reinterpret_cast<char*>(&counter_)) + sizeof(user_approval_));
  // @@protoc_insertion_point(copy_constructor:securegcm.IdentityAssertion)
}

inline void IdentityAssertion::SharedCtor() {
browser_data_hash_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  browser_data_hash_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&counter_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&user_approval_) -
    reinterpret_cast<char*>(&counter_)) + sizeof(user_approval_));
}

IdentityAssertion::~IdentityAssertion() {
  // @@protoc_insertion_point(destructor:securegcm.IdentityAssertion)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void IdentityAssertion::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  browser_data_hash_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

void IdentityAssertion::ArenaDtor(void* object) {
  IdentityAssertion* _this = reinterpret_cast< IdentityAssertion* >(object);
  (void)_this;
}
void IdentityAssertion::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void IdentityAssertion::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void IdentityAssertion::Clear() {
// @@protoc_insertion_point(message_clear_start:securegcm.IdentityAssertion)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    browser_data_hash_.ClearNonDefaultToEmpty();
  }
  if (cached_has_bits & 0x00000006u) {
    ::memset(&counter_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&user_approval_) -
        reinterpret_cast<char*>(&counter_)) + sizeof(user_approval_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* IdentityAssertion::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional bytes browser_data_hash = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          auto str = _internal_mutable_browser_data_hash();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional int64 counter = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
          _Internal::set_has_counter(&has_bits);
          counter_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional int32 user_approval = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
          _Internal::set_has_user_approval(&has_bits);
          user_approval_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* IdentityAssertion::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:securegcm.IdentityAssertion)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional bytes browser_data_hash = 1;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteBytesMaybeAliased(
        1, this->_internal_browser_data_hash(), target);
  }

  // optional int64 counter = 2;
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_counter(), target);
  }

  // optional int32 user_approval = 3;
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_user_approval(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:securegcm.IdentityAssertion)
  return target;
}

size_t IdentityAssertion::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:securegcm.IdentityAssertion)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    // optional bytes browser_data_hash = 1;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
          this->_internal_browser_data_hash());
    }

    // optional int64 counter = 2;
    if (cached_has_bits & 0x00000002u) {
      total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_counter());
    }

    // optional int32 user_approval = 3;
    if (cached_has_bits & 0x00000004u) {
      total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_user_approval());
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void IdentityAssertion::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const IdentityAssertion*>(
      &from));
}

void IdentityAssertion::MergeFrom(const IdentityAssertion& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:securegcm.IdentityAssertion)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_browser_data_hash(from._internal_browser_data_hash());
    }
    if (cached_has_bits & 0x00000002u) {
      counter_ = from.counter_;
    }
    if (cached_has_bits & 0x00000004u) {
      user_approval_ = from.user_approval_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void IdentityAssertion::CopyFrom(const IdentityAssertion& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:securegcm.IdentityAssertion)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool IdentityAssertion::IsInitialized() const {
  return true;
}

void IdentityAssertion::InternalSwap(IdentityAssertion* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
      &browser_data_hash_, lhs_arena,
      &other->browser_data_hash_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(IdentityAssertion, user_approval_)
      + sizeof(IdentityAssertion::user_approval_)
      - PROTOBUF_FIELD_OFFSET(IdentityAssertion, counter_)>(
          reinterpret_cast<char*>(&counter_),
          reinterpret_cast<char*>(&other->counter_));
}

std::string IdentityAssertion::GetTypeName() const {
  return "securegcm.IdentityAssertion";
}


// @@protoc_insertion_point(namespace_scope)
}  // namespace securegcm
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::securegcm::IdentityAssertion* Arena::CreateMaybeMessage< ::securegcm::IdentityAssertion >(Arena* arena) {
  return Arena::CreateMessageInternal< ::securegcm::IdentityAssertion >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
