"""This module holds the django admin models for the ``workshops`` app."""

from django.contrib import admin

from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin

from .models import (
    Workshop,
    WorkshopStep,
    WorkshopStepQuestion,
    WorkshopStepImage,
    WorkshopStepQuestionUserAnswer,
)


class WorkshopStepQuestionAdmin(PolymorphicChildModelAdmin):
    """Child django admin class for the ``WorkshopStepQuestion`` model."""

    base_model = WorkshopStepQuestion


class WorkshopStepImageAdmin(PolymorphicChildModelAdmin):
    """Child django admin class for the ``WorkshopStepQuestion`` model."""

    base_model = WorkshopStepImage


class WorkshopStepAdmin(PolymorphicParentModelAdmin):
    """Parent django admin class for the ``WorkshopStep`` model."""

    base_model = WorkshopStep
    child_models = (
        (WorkshopStepQuestion, WorkshopStepQuestionAdmin),
        (WorkshopStepImage, WorkshopStepImageAdmin),
    )


admin.site.register(Workshop)
admin.site.register(WorkshopStep, WorkshopStepAdmin)
