from django.contrib import admin
from animations.models import PuzzlePointsFactor, PuzzlePointsValue


@admin.register(PuzzlePointsFactor)
class PuzzlePointsFactorAdmin(admin.ModelAdmin):
    list_display = [
        "id",
        "cost",
        "cycles",
        "area",
        "special_notes",
    ]
    list_filter = ["cost", "cycles", "area", "special_notes"]
    search_fields = ["cost", "cycles", "area", "special_notes"]
    readonly_fields = ["created_at", "updated_at"]

    fieldsets = (
        (
            "Basic Information",
            {"fields": ("cost", "cycles", "area")},
        ),
        (
            "Special notes",
            {
                "fields": ("special_notes",),
                "description": "Special notes about the puzzle. May be some extra restriction, etc...",
            },
        ),
        (
            "Metadata",
            {
                "fields": ("created_at", "updated_at"),
                "classes": ("collapse",),
            },
        ),
    )


@admin.register(PuzzlePointsValue)
class PuzzlePointsValueAdmin(admin.ModelAdmin):
    list_display = ["id", "points"]
    list_filter = ["points"]
    search_fields = ["points"]
    readonly_fields = ["created_at", "updated_at"]

    fieldsets = (
        (
            "Basic Information",
            {"fields": ("points",)},
        ),
        (
            "Metadata",
            {
                "fields": ("created_at", "updated_at"),
                "classes": ("collapse",),
            },
        ),
    )
