<?php

namespace Drupal\ouatt_graphql\Plugin\GraphQL\Schema;

use Drupal\graphql\Plugin\GraphQL\Schema\ComposableSchema;
use Drupal\graphql\GraphQL\ResolverBuilder;
use Drupal\graphql\GraphQL\ResolverRegistry;
// use Drupal\graphql\Plugin\GraphQL\Schema\SdlSchemaPluginBase;
use GraphQL\Error\Error;
/**
 * @Schema(
 *   id = "ouatt",
 *   name = "Ou Atterrir schema",
 *   extensions = "ouatt",
 * )
 */
class OuattSchema extends ComposableSchema {

  // /**
  //  * {@inheritdoc}
  //  */
  // public function getResolverRegistry() {
  //   $builder = new ResolverBuilder();
  //   $registry = new ResolverRegistry();
  //
  //   // Tell GraphQL how to resolve types of a common interface.
  //   $registry->addTypeResolver('NodeInterface', function ($value) {
  //     if ($value instanceof NodeInterface) {
  //       switch ($value->bundle()) {
  //         case 'article': return 'Article';
  //         case 'materiau': return 'Materiau';
  //       }
  //     }
  //     throw new Error('Could not resolve content type.');
  //   });
  //
  //   $registry->addFieldResolver('Query', 'route', $builder->compose(
  //     $builder->produce('route_load')
  //       ->map('path', $builder->fromArgument('path')),
  //     $builder->produce('route_entity')
  //       ->map('url', $builder->fromParent())
  //   ));
  //
  //   return $registry;
  // }

}
