from rest_framework import serializers
from helpdesk.models import Ticket
from .user_serializers import SimpleUserSerializer

class TicketListSerializer(serializers.ModelSerializer):
    """ใช้สำหรับแสดงรายการ Ticket ใน Unified Inbox"""
    creator = SimpleUserSerializer(read_only=True)
    assigned_to = SimpleUserSerializer(read_only=True)

    class Meta:
        model = Ticket
        fields = [
            'id', 'title', 'status', 'creator', 'assigned_to',
            'last_message_at', 'last_message_content', 'is_read'
        ]