from wagtail.contrib.modeladmin.options import (
    ModelAdmin,
    ModelAdminGroup,
    modeladmin_register,
)
from .models.module import ModuleLevel, ModuleCategory, Module
from django.utils.translation import gettext_lazy as _


class ModuleAdmin(ModelAdmin):
    model = Module
    list_display = ("title", "meta_title", "level", "category")
    search_fields = ("title", "meta_title")
    list_filter = ("level", "category")


class ModuleLevelAdmin(ModelAdmin):
    model = ModuleLevel
    list_display = ("name","filter_attribute_type", "order")


class ModuleCategoryAdmin(ModelAdmin):
    model = ModuleCategory
    list_display = ("name", "filter_attribute_type", "order")


class InstrumentGroup(ModelAdminGroup):
    menu_label = _("Modules")
    items = (
        ModuleAdmin,
        ModuleLevelAdmin,
        ModuleCategoryAdmin,
    )


modeladmin_register(InstrumentGroup)
