from django.contrib import admin

from .models import Product, ProductImage, ProductSellingPoint


class ProductImageInline(admin.TabularInline):
    model = ProductImage
    extra = 0


class ProductSellingPointInline(admin.TabularInline):
    model = ProductSellingPoint
    extra = 0


@admin.register(Product)
class ProductAdmin(admin.ModelAdmin):
    list_display = ("title", "team", "brand", "category", "status", "updated_at")
    search_fields = ("title", "brand", "category", "team__name")
    list_filter = ("status", "category")
    inlines = [ProductImageInline, ProductSellingPointInline]

