from rest_framework import serializers

from .models import *

from apps.system.serializers import DictSerializer, UserListSerializer


class EmployeeSerializer(serializers.ModelSerializer):
    """
    普通序列化
    """
    user = UserListSerializer()
    class Meta:
        model = Employee
        fields = '__all__'

    @staticmethod
    def setup_eager_loading(queryset):
        """ Perform necessary eager loading of data. """
        queryset = queryset.select_related('user')
        return queryset

class QualificationSerializer(serializers.ModelSerializer):
    """
    普通序列化
    """
    class Meta:
        model = Qualification
        fields = '__all__'

class AbilitySerializer(serializers.ModelSerializer):
    """
    普通序列化
    """
    class Meta:
        model = Ability
        fields = '__all__'

class EducationSerializer(serializers.ModelSerializer):
    """
    普通序列化
    """
    class Meta:
        model = Education
        fields = '__all__'

class TrainSerializer(serializers.ModelSerializer):
    """
    普通序列化
    """
    class Meta:
        model = Train
        fields = '__all__'