import graphene from graphene import InputObjectType class InputTypes(graphene.Enum): text_block = "text_block" # basic_knowledge = 'basic_knowledge' # probably won't be using this over the API assignment = "assignment" image_block = "image_block" image_url_block = "image_url_block" link_block = "link_block" video_block = "video_block" document_block = "document_block" content_list_item = "content_list_item" subtitle = "subtitle" solution = "solution" readonly = "readonly" class ContentElementValueInput(InputObjectType): # we'll handle this with a single input, even tho it would be nice to have a type for every different possibility # see discussion at https://github.com/graphql/graphql-js/issues/207 text = graphene.String(description="To be used for link_block, text_block types") url = graphene.String(description="To be used for link, image_block types") description = graphene.String(description="To be used for basic_knowledge type") title = graphene.String(description="To be used for image_block, assignment type") assignment = graphene.String(description="To be used for assignment type") id = graphene.String(description="To be used for assignment type") class ContentElementInput(InputObjectType): id = graphene.String() type = InputTypes(required=True) value = ContentElementValueInput() contents = graphene.List("books.schema.inputs.ContentElementInput") class UserGroupBlockVisibility(InputObjectType): school_class_id = graphene.ID(required=True) hidden = graphene.Boolean(required=True) class ContentBlockInput(InputObjectType): title = graphene.String() type = graphene.String() contents = graphene.List(ContentElementInput) visibility = graphene.List(UserGroupBlockVisibility)