import graphene

from vbv_lernwelt.course.graphql.types import resolve_course_page
from vbv_lernwelt.learnpath.graphql.types import LearningPathObjectType
from vbv_lernwelt.learnpath.models import LearningPath


class LearningPathQuery:
    learning_path = graphene.Field(
        LearningPathObjectType,
        id=graphene.ID(),
        slug=graphene.String(),
        course_id=graphene.ID(),
        course_slug=graphene.String(),
    )

    def resolve_learning_path(
        root, info, id=None, slug=None, course_id=None, course_slug=None
    ):
        return resolve_course_page(
            LearningPath,
            root,
            info,
            id=id,
            slug=slug,
            course_id=course_id,
            course_slug=course_slug,
        )
