from rest_framework import serializers
from .models import Product, ContactMessage , ProductFeature , FAQ

# Feature serializer 
class ProductFeatureSerializer(serializers.ModelSerializer):
    class Meta:
        model = ProductFeature
        fields = ['key_uz', 'key_ru', 'value_uz', 'value_ru']

class ProductSerializer(serializers.ModelSerializer):
    features = ProductFeatureSerializer(many=True, read_only=True) 

    class Meta:
        model = Product
        fields = ['id', 'slug','name_uz', 'name_ru', 'description_uz', 'description_ru', 'features','image']


class ContactSerializer(serializers.ModelSerializer):
    class Meta:
        model = ContactMessage
        fields = "__all__"

class FAQSerializer(serializers.ModelSerializer):
    class Meta:
        model = FAQ
        fields = [
            'id',
            'question_uz',
            'question_ru',
            'answer_uz',
            'answer_ru',
        ]
