import graphene
from django.conf import settings
from graphene import relay
from graphene_django.debug import DjangoDebug

# noinspection PyUnresolvedReferences
from api import graphene_wagtail  # Keep this import exactly here, it's necessary for StreamField conversion
from assignments.schema.mutations import AssignmentMutations
from assignments.schema.queries import AssignmentsQuery, StudentSubmissionQuery
from basicknowledge.queries import BasicKnowledgeQuery
from books.schema.mutations import BookMutations
from books.schema.queries import BookQuery
from news.schema import AllNewsTeasersQuery
from oauth.mutations import OauthMutations
from notes.mutations import NoteMutations
from objectives.mutations import ObjectiveMutations
from objectives.schema import ObjectivesQuery
from portfolio.mutations import PortfolioMutations
from portfolio.schema import PortfolioQuery
from spellcheck.mutations import SpellCheckMutations
from surveys.schema import SurveysQuery
from surveys.mutations import SurveyMutations
from rooms.mutations import RoomMutations
from rooms.schema import RoomsQuery, ModuleRoomsQuery
from users.schema import AllUsersQuery, UsersQuery
from users.mutations import ProfileMutations


class CustomQuery(UsersQuery, AllUsersQuery, ModuleRoomsQuery, RoomsQuery, ObjectivesQuery, BookQuery, AssignmentsQuery,
            StudentSubmissionQuery, BasicKnowledgeQuery, PortfolioQuery, SurveysQuery, AllNewsTeasersQuery, graphene.ObjectType):
    node = relay.Node.Field()

    if settings.DEBUG:
        debug = graphene.Field(DjangoDebug, name='_debug')


class CustomMutation(BookMutations, RoomMutations, AssignmentMutations, ObjectiveMutations, OauthMutations,
                     PortfolioMutations, ProfileMutations, SurveyMutations, NoteMutations, SpellCheckMutations,
                     graphene.ObjectType):
    if settings.DEBUG:
        debug = graphene.Field(DjangoDebug, name='_debug')


schema = graphene.Schema(query=CustomQuery, mutation=CustomMutation)
