import graphene

from vbv_lernwelt.core.utils import get_django_content_type
from vbv_lernwelt.learnpath.models import Circle


class CoursePageInterface(graphene.Interface):
    id = graphene.ID(required=True)
    title = graphene.String(required=True)
    slug = graphene.String(required=True)
    content_type = graphene.String(required=True)
    live = graphene.Boolean(required=True)
    translation_key = graphene.String(required=True)
    frontend_url = graphene.String(required=True)
    course = graphene.Field("vbv_lernwelt.course.graphql.types.CourseObjectType")

    def resolve_frontend_url(self, info):
        return self.get_frontend_url()

    def resolve_content_type(self, info):
        return get_django_content_type(self)

    def resolve_course(self, info):
        return self.get_course()
