text: // Copyright (c) Microsoft Corporation. All rights reserved.
  // Licensed under the MIT License.
  
  // WARNING! Do not edit this file manually, your changes will be overwritten.
  
  #pragma once
  
  #ifndef FOLDERCONNECTIONOBJECT_H
  #define FOLDERCONNECTIONOBJECT_H
  
  #include "TodaySchema.h"
  
  namespace graphql::today::object {
  namespace methods::FolderConnectionHas {
  
  template <class TImpl>
  concept getPageInfoWithParams = requires (TImpl impl, service::FieldParams params) 
  {
  	{ service::AwaitableObject<std::shared_ptr<PageInfo>> { impl.getPageInfo(std::move(params)) } };
  };
  
  template <class TImpl>
  concept getPageInfo = requires (TImpl impl) 
  {
  	{ service::AwaitableObject<std::shared_ptr<PageInfo>> { impl.getPageInfo() } };
  };
  
  template <class TImpl>
  concept getEdgesWithParams = requires (TImpl impl, service::FieldParams params) 
  {
  	{ service::AwaitableObject<std::optional<std::vector<std::shared_ptr<FolderEdge>>>> { impl.getEdges(std::move(params)) } };
  };
  
  template <class TImpl>
  concept getEdges = requires (TImpl impl) 
  {
  	{ service::AwaitableObject<std::optional<std::vector<std::shared_ptr<FolderEdge>>>> { impl.getEdges() } };
  };
  
  template <class TImpl>
  concept beginSelectionSet = requires (TImpl impl, const service::SelectionSetParams params) 
  {
  	{ impl.beginSelectionSet(params) };
  };
  
  template <class TImpl>
  concept endSelectionSet = requires (TImpl impl, const service::SelectionSetParams params) 
  {
  	{ impl.endSelectionSet(params) };
  };
  
  } // namespace methods::FolderConnectionHas
  
  class FolderConnection
  	: public service::Object
  {
  private:
  	service::AwaitableResolver resolvePageInfo(service::ResolverParams&& params) const;
  	service::AwaitableResolver resolveEdges(service::ResolverParams&& params) const;
  
  	service::AwaitableResolver resolve_typename(service::ResolverParams&& params) const;
  
  	struct Concept
  	{
  		virtual ~Concept() = default;
  
  		virtual void beginSelectionSet(const service::SelectionSetParams& params) const = 0;
  		virtual void endSelectionSet(const service::SelectionSetParams& params) const = 0;
  
  		virtual service::AwaitableObject<std::shared_ptr<PageInfo>> getPageInfo(service::FieldParams&& params) const = 0;
  		virtual service::AwaitableObject<std::optional<std::vector<std::shared_ptr<FolderEdge>>>> getEdges(service::FieldParams&& params) const = 0;
  	};
  
  	template <class T>
  	struct Model
  		: Concept
  	{
  		Model(std::shared_ptr<T>&& pimpl) noexcept
  			: _pimpl { std::move(pimpl) }
  		{
  		}
  
  		service::AwaitableObject<std::shared_ptr<PageInfo>> getPageInfo(service::FieldParams&& params) const final
  		{
  			if constexpr (methods::FolderConnectionHas::getPageInfoWithParams<T>)
  			{
  				return { _pimpl->getPageInfo(std::move(params)) };
  			}
  			else if constexpr (methods::FolderConnectionHas::getPageInfo<T>)
  			{
  				return { _pimpl->getPageInfo() };
  			}
  			else
  			{
  				throw std::runtime_error(R"ex(FolderConnection::getPageInfo is not implemented)ex");
  			}
  		}
  
  		service::AwaitableObject<std::optional<std::vector<std::shared_ptr<FolderEdge>>>> getEdges(service::FieldParams&& params) const final
  		{
  			if constexpr (methods::FolderConnectionHas::getEdgesWithParams<T>)
  			{
  				return { _pimpl->getEdges(std::move(params)) };
  			}
  			else if constexpr (methods::FolderConnectionHas::getEdges<T>)
  			{
  				return { _pimpl->getEdges() };
  			}
  			else
  			{
  				throw std::runtime_error(R"ex(FolderConnection::getEdges is not implemented)ex");
  			}
  		}
  
  		void beginSelectionSet(const service::SelectionSetParams& params) const final
  		{
  			if constexpr (methods::FolderConnectionHas::beginSelectionSet<T>)
  			{
  				_pimpl->beginSelectionSet(params);
  			}
  		}
  
  		void endSelectionSet(const service::SelectionSetParams& params) const final
  		{
  			if constexpr (methods::FolderConnectionHas::endSelectionSet<T>)
  			{
  				_pimpl->endSelectionSet(params);
  			}
  		}
  
  	private:
  		const std::shared_ptr<T> _pimpl;
  	};
  
  	FolderConnection(std::unique_ptr<Concept>&& pimpl) noexcept;
  
  	service::TypeNames getTypeNames() const noexcept;
  	service::ResolverMap getResolvers() const noexcept;
  
  	void beginSelectionSet(const service::SelectionSetParams& params) const final;
  	void endSelectionSet(const service::SelectionSetParams& params) const final;
  
  	const std::unique_ptr<Concept> _pimpl;
  
  public:
  	template <class T>
  	FolderConnection(std::shared_ptr<T> pimpl) noexcept
  		: FolderConnection { std::unique_ptr<Concept> { std::make_unique<Model<T>>(std::move(pimpl)) } }
  	{
  	}
  };
  
  } // namespace graphql::today::object
  
  #endif // FOLDERCONNECTIONOBJECT_H
  