import logging

from wagtail.admin.edit_handlers import FieldPanel, TabbedInterface, ObjectList

from core.wagtail_utils import StrictHierarchyPage

logger = logging.getLogger(__name__)


class Book(StrictHierarchyPage):
    class Meta:
        verbose_name = 'Buch'
        verbose_name_plural = 'Bücher'

    content_panels = [
        FieldPanel('title', classname="full title")
    ]

    settings_panels = [
        FieldPanel('slug')
    ]

    edit_handler = TabbedInterface([
        ObjectList(content_panels, heading='Content'),
        ObjectList(settings_panels, heading='Settings'),
    ])

    template = 'generic_page.html'

    subpage_types = ['books.Topic', 'basicknowledge.BasicKnowledge']
