from wagtail.admin.panels import FieldPanel
from wagtail.fields import StreamField

from apps.core.blocks import COMMON_BLOCKS
from apps.core.models import SEOablePage


class HomePage(SEOablePage):
    """企业官网首页，使用通用组件化 StreamField 拼装页面内容。"""

    body = StreamField(COMMON_BLOCKS, use_json_field=True, blank=True)

    content_panels = SEOablePage.content_panels + [
        FieldPanel("body"),
    ]

    subpage_types = [
        "blog.BlogIndexPage",
        "products.ProductIndexPage",
        "solutions.SolutionIndexPage",
        "cases.CaseStudyIndexPage",
        "core.SimpleContentPage",
    ]

    class Meta:
        verbose_name = "首页"
