from django.contrib import admin
from .models import Product, ProductFeature, ContactMessage, FAQ

# ========== INLINE for Product Features for github ==========
class ProductFeatureInline(admin.TabularInline):
    model = ProductFeature
    extra = 1


# ========== PRODUCT ADMIN ==========
@admin.register(Product)
class ProductAdmin(admin.ModelAdmin):
    list_display = ('name_uz', 'name_ru', 'image')
    inlines = [ProductFeatureInline]


# ========== CONTACT MESSAGE ADMIN ==========
@admin.register(ContactMessage)
class ContactAdmin(admin.ModelAdmin):
    list_display = ('name', 'phone', 'product_name', 'created_at')
    search_fields = ('name', 'phone', 'product_name')


# ========== FAQ ADMIN ==========
@admin.register(FAQ)
class FAQAdmin(admin.ModelAdmin):
    list_display = ('question_uz', 'question_ru')
    search_fields = ('question_uz', 'question_ru')