from django.contrib import admin
from .models import Ticket
from chat.models import Message

class MessageInline(admin.TabularInline):
    model = Message
    extra = 0
    readonly_fields = ('sender', 'content', 'message_type', 'timestamp')

@admin.register(Ticket)
class TicketAdmin(admin.ModelAdmin):
    list_display = ('id', 'title', 'creator', 'assigned_to', 'status', 'last_message_at')
    inlines = [MessageInline]
