from django.contrib import admin
from unfold.admin import ModelAdmin  # noqa

from apps.geology.models import Geology


@admin.register(Geology)
class GeologyAdmin(ModelAdmin):
    list_display = ("name", "category", "created_at", "updated_at")
    search_fields = ("name", "title", "body1", "body2", "body3")
    list_filter = ("category", "created_at", "updated_at")
    filter_horizontal = ("photos1", "photos2")
    readonly_fields = ("created_at", "updated_at")
    autocomplete_fields = ("category",)
    fieldsets = (
        (
            "Asosiy ma'lumotlar",
            {
                "fields": (
                    "category",
                    "banner_title",
                    "banner",
                    "name",
                    "title",
                    "body1",
                    "address",
                    "image",
                    "location",
                    "composition",
                    "isp",
                    "analysis",
                    "body2",
                    "photos1",
                    "body3",
                    "photos2",
                )
            },
        ),
        (
            "Qo'shimcha ma'lumotlar",
            {
                "fields": (
                    "created_at",
                    "updated_at",
                )
            },
        ),
    )
