from apps.system.models import User
from rest_framework.serializers import ModelSerializer
from rest_framework import serializers
from .models import Employee
from apps.system.serializers import UserListSerializer, UserSimpleSerializer
from django.db.models.query import Prefetch

class EmployeeSerializer(ModelSerializer):
    # user_ = UserListSerializer(source='user', read_only=True)
    class Meta:
        model = Employee
        fields = '__all__'
    # @staticmethod
    # def setup_eager_loading(queryset):
    #     """ Perform necessary eager loading of data. """
    #     queryset = queryset.select_related('user', 'user__dept')
    #     # queryset = queryset.prefetch_related('user','user__dept')
    #     queryset = queryset.prefetch_related(
    #         Prefetch('user_', 
    #             queryset=User.objects.filter(employee_user__isnull=True))
    #         )
    #     return queryset

class FaceLoginSerializer(serializers.Serializer):
    base64 = serializers.CharField()
