/**
 * Autogenerated by Thrift for /opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.12.15.00/thrift/lib/thrift/schema.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/schema_metadata.h"
#include <thrift/lib/cpp2/visitation/visit_union.h>

namespace apache {
namespace thrift {
namespace detail {

template <>
struct VisitUnion<::apache::thrift::type::ReturnType> {

  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::thriftType:
      return f(0, *static_cast<T&&>(t).thriftType_ref());
    case Union::Type::streamType:
      return f(1, *static_cast<T&&>(t).streamType_ref());
    case Union::Type::sinkType:
      return f(2, *static_cast<T&&>(t).sinkType_ref());
    case Union::Type::interactionType:
      return f(3, *static_cast<T&&>(t).interactionType_ref());
    case Union::Type::__EMPTY__:
      return decltype(f(0, *static_cast<T&&>(t).thriftType_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()))};
    }
  }
};
template <>
struct VisitUnion<::apache::thrift::type::Definition> {

  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::structDef:
      return f(0, *static_cast<T&&>(t).structDef_ref());
    case Union::Type::unionDef:
      return f(1, *static_cast<T&&>(t).unionDef_ref());
    case Union::Type::exceptionDef:
      return f(2, *static_cast<T&&>(t).exceptionDef_ref());
    case Union::Type::enumDef:
      return f(3, *static_cast<T&&>(t).enumDef_ref());
    case Union::Type::typedefDef:
      return f(4, *static_cast<T&&>(t).typedefDef_ref());
    case Union::Type::constDef:
      return f(5, *static_cast<T&&>(t).constDef_ref());
    case Union::Type::serviceDef:
      return f(6, *static_cast<T&&>(t).serviceDef_ref());
    case Union::Type::interactionDef:
      return f(7, *static_cast<T&&>(t).interactionDef_ref());
    case Union::Type::__EMPTY__:
      return decltype(f(0, *static_cast<T&&>(t).structDef_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
