# Copyright (C) 2018-2025 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later

from rest_framework import serializers

from ..models import Family, FamilyMembership, Challenge, Achievement


class FamilySerializer(serializers.ModelSerializer):
    """
    REST API Serializer for Family.
    The djangorestframework plugin will analyse the model `Family` and parse all fields in the API.
    """
    class Meta:
        model = Family
        fields = '__all__'


class FamilyMembershipSerializer(serializers.ModelSerializer):
    """
    REST API Serializer for FamilyMembership.
    The djangorestframework plugin will analyse the model `FamilyMembership` and parse all fields in the API.
    """
    class Meta:
        model = FamilyMembership
        fields = '__all__'


class ChallengeSerializer(serializers.ModelSerializer):
    """
    REST API Serializer for Challenge.
    The djangorestframework plugin will analyse the model `Challenge` and parse all fields in the API.
    """
    class Meta:
        model = Challenge
        fields = '__all__'


class AchievementSerializer(serializers.ModelSerializer):
    """
    REST API Serializer for Achievement.
    The djangorestframework plugin will analyse the model `Achievement` and parse all fields in the API.
    """
    class Meta:
        model = Achievement
        fields = '__all__'
