/**
 * Autogenerated by Thrift for /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_fbthrift/fbthrift/work/fbthrift-2024.08.26.00/thrift/lib/thrift/RpcMetadata.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/RpcMetadata_metadata.h"
#include <thrift/lib/cpp2/visitation/visit_union.h>

namespace apache {
namespace thrift {
namespace detail {

template <>
struct VisitUnion<::apache::thrift::CodecConfig> {

  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::zlibConfig:
      return f(0, *static_cast<T&&>(t).zlibConfig_ref());
    case Union::Type::zstdConfig:
      return f(1, *static_cast<T&&>(t).zstdConfig_ref());
    case Union::Type::__EMPTY__:
      return decltype(f(0, *static_cast<T&&>(t).zlibConfig_ref()))();
    }
  }
};
template <>
struct VisitUnion<::apache::thrift::PayloadExceptionMetadata> {

  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::declaredException:
      return f(0, *static_cast<T&&>(t).declaredException_ref());
    case Union::Type::DEPRECATED_proxyException:
      return f(1, *static_cast<T&&>(t).DEPRECATED_proxyException_ref());
    case Union::Type::appUnknownException:
      return f(2, *static_cast<T&&>(t).appUnknownException_ref());
    case Union::Type::anyException:
      return f(3, *static_cast<T&&>(t).anyException_ref());
    case Union::Type::__EMPTY__:
      return decltype(f(0, *static_cast<T&&>(t).declaredException_ref()))();
    }
  }
};
template <>
struct VisitUnion<::apache::thrift::PayloadMetadata> {

  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::responseMetadata:
      return f(0, *static_cast<T&&>(t).responseMetadata_ref());
    case Union::Type::exceptionMetadata:
      return f(1, *static_cast<T&&>(t).exceptionMetadata_ref());
    case Union::Type::__EMPTY__:
      return decltype(f(0, *static_cast<T&&>(t).responseMetadata_ref()))();
    }
  }
};
template <>
struct VisitUnion<::apache::thrift::ServerPushMetadata> {

  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::setupResponse:
      return f(0, *static_cast<T&&>(t).setupResponse_ref());
    case Union::Type::streamHeadersPush:
      return f(1, *static_cast<T&&>(t).streamHeadersPush_ref());
    case Union::Type::drainCompletePush:
      return f(2, *static_cast<T&&>(t).drainCompletePush_ref());
    case Union::Type::__EMPTY__:
      return decltype(f(0, *static_cast<T&&>(t).setupResponse_ref()))();
    }
  }
};
template <>
struct VisitUnion<::apache::thrift::ClientPushMetadata> {

  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::interactionTerminate:
      return f(0, *static_cast<T&&>(t).interactionTerminate_ref());
    case Union::Type::streamHeadersPush:
      return f(1, *static_cast<T&&>(t).streamHeadersPush_ref());
    case Union::Type::transportMetadataPush:
      return f(2, *static_cast<T&&>(t).transportMetadataPush_ref());
    case Union::Type::__EMPTY__:
      return decltype(f(0, *static_cast<T&&>(t).interactionTerminate_ref()))();
    }
  }
};
} // namespace detail
} // namespace thrift
} // namespace apache
