from rest_framework import serializers

from .models import Notification


class NotificationSerializer(serializers.ModelSerializer):
    """前端列表展示用 — 字段 contract 与 web 端 NotificationItem 一致。"""

    class Meta:
        model = Notification
        fields = (
            'id',
            'type',
            'title',
            'content',
            'link_url',
            'is_read',
            'created_at',
        )
        read_only_fields = fields
