from rest_framework import serializers

from review.models import Review, Inquiries, GridItems


class ReviewBaseSerializer(serializers.ModelSerializer):
    class Meta:
        model = Review
        fields = (
            'id',
            'reviewer',
            'text',
            'priority',
            'status',
            'child',
            'published_at',
            'vintage',
            'country',
            'content_type',
            'object_id',
        )


class ReviewShortSerializer(ReviewBaseSerializer):
    """Serializer for model Review."""
    text_translated = serializers.CharField(read_only=True)

    class Meta(ReviewBaseSerializer.Meta):
        """Meta class."""
        fields = (
            'text_translated',
        )


class InquiriesBaseSerializer(serializers.ModelSerializer):
    """Serializer for model Inquiries."""

    class Meta:
        model = Inquiries
        fields = (
            'id',
            'review',
            'comment',
            'final_comment',
            'mark',
            'attachment_file',
            'author',
            'bill_file',
            'price',
            'moment',
            'gallery',
            'decibels',
            'nomination',
            'nominee',
            'published',
        )


class GridItemsBaseSerializer(serializers.ModelSerializer):
    """Serializer for model GridItems."""

    class Meta:
        model = GridItems
        fields = (
            'id',
            'inquiry',
            'sub_name',
            'name',
            'value',
            'desc',
            'dish_title',
        )
