from django.contrib import admin
from unfold.admin import ModelAdmin, TabularInline

from .models import Plan, PlanFeature


class PlanFeatureInline(TabularInline):
    model = PlanFeature
    extra = 0


@admin.register(Plan)
class PlanAdmin(ModelAdmin):
    list_display = ["name", "service", "price", "period", "is_highlighted", "is_published", "order"]
    list_editable = ["is_highlighted", "is_published", "order"]
    list_filter = ["service", "is_published"]
    inlines = [PlanFeatureInline]
