/**
 * Autogenerated by Thrift for /opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.12.15.00/thrift/lib/thrift/record.thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated @nocommit
 */
#pragma once

#include "thrift/lib/thrift/gen-cpp2/record_metadata.h"
#include <thrift/lib/cpp2/visitation/visit_union.h>

namespace apache {
namespace thrift {
namespace detail {

template <>
struct VisitUnion<::apache::thrift::type_system::SerializableRecordUnion> {

  template <typename F, typename T>
  decltype(auto) operator()([[maybe_unused]] F&& f, T&& t) const {
    using Union = std::remove_reference_t<T>;
    switch (t.getType()) {
    case Union::Type::boolDatum:
      return f(0, *static_cast<T&&>(t).boolDatum_ref());
    case Union::Type::int8Datum:
      return f(1, *static_cast<T&&>(t).int8Datum_ref());
    case Union::Type::int16Datum:
      return f(2, *static_cast<T&&>(t).int16Datum_ref());
    case Union::Type::int32Datum:
      return f(3, *static_cast<T&&>(t).int32Datum_ref());
    case Union::Type::int64Datum:
      return f(4, *static_cast<T&&>(t).int64Datum_ref());
    case Union::Type::float32Datum:
      return f(5, *static_cast<T&&>(t).float32Datum_ref());
    case Union::Type::float64Datum:
      return f(6, *static_cast<T&&>(t).float64Datum_ref());
    case Union::Type::textDatum:
      return f(7, *static_cast<T&&>(t).textDatum_ref());
    case Union::Type::byteArrayDatum:
      return f(8, *static_cast<T&&>(t).byteArrayDatum_ref());
    case Union::Type::fieldSetDatum:
      return f(9, *static_cast<T&&>(t).fieldSetDatum_ref());
    case Union::Type::listDatum:
      return f(10, *static_cast<T&&>(t).listDatum_ref());
    case Union::Type::setDatum:
      return f(11, *static_cast<T&&>(t).setDatum_ref());
    case Union::Type::mapDatum:
      return f(12, *static_cast<T&&>(t).mapDatum_ref());
    case Union::Type::__EMPTY__:
      return decltype(f(0, *static_cast<T&&>(t).boolDatum_ref()))();
    default:
      throw std::runtime_error{folly::to<std::string>(
          "Enum got invalid value ",
          static_cast<std::underlying_type_t<decltype(t.getType())>>(
              t.getType()))};
    }
  }
};
} // namespace detail
} // namespace thrift
} // namespace apache
