from django.contrib import admin
from .models import Lead, LeadAttachment, LeadActivity, Meeting


@admin.register(Lead)
class LeadAdmin(admin.ModelAdmin):
    list_display = ['title', 'client_name', 'service_type', 'priority', 'status', 'created_by', 'created_at']
    list_filter = ['status', 'service_type', 'priority', 'lead_source']
    search_fields = ['title', 'client_name', 'client_email']
    readonly_fields = ['created_at', 'updated_at']


@admin.register(LeadAttachment)
class LeadAttachmentAdmin(admin.ModelAdmin):
    list_display = ['file_name', 'lead', 'uploaded_by', 'uploaded_at']
    list_filter = ['uploaded_at']


@admin.register(LeadActivity)
class LeadActivityAdmin(admin.ModelAdmin):
    list_display = ['lead', 'actor', 'action', 'timestamp']
    list_filter = ['action', 'timestamp']
    readonly_fields = ['lead', 'actor', 'action', 'details', 'timestamp']


@admin.register(Meeting)
class MeetingAdmin(admin.ModelAdmin):
    list_display = ['title', 'meeting_type', 'date', 'time', 'outcome', 'is_completed']
    list_filter = ['meeting_type', 'outcome', 'is_completed']
    search_fields = ['title']
