from django.contrib import admin
from .models import CertificateTemplate, CertificateInstance


@admin.register(CertificateTemplate)
class CertificateTemplateAdmin(admin.ModelAdmin):
    list_display = ('title', 'company', 'is_active', 'created')
    list_filter = ('is_active', 'company')
    search_fields = ('title', 'company__name')
    autocomplete_fields = ('company',)


@admin.register(CertificateInstance)
class CertificateInstanceAdmin(admin.ModelAdmin):
    list_display = ('process_instance', 'rendered_title', 'issued_at', 'approved')
    list_filter = ('approved', 'issued_at')
    search_fields = ('process_instance__code', 'rendered_title')
    autocomplete_fields = ('process_instance', 'template')


