from rest_framework import status, viewsets, authentication, permissions
from rest_framework.decorators import api_view, action
from rest_framework.response import Response

from users.models import Balance
from upload.models import Media
from .serializers import BalanceSerializer, ImageSerializer

class AllBalance(viewsets.ModelViewSet):
    serializer_class = BalanceSerializer
    http_method_names = ['get']

    def get_queryset(self):
        return Balance.objects.all()
    

class BalanceView(viewsets.ModelViewSet):
    serializer_class = BalanceSerializer
    http_method_names = ['get']

    def get_queryset(self):
        return Balance.objects.filter(user=self.request.user)
    

class ImageView(viewsets.ModelViewSet):
    serializer_class = ImageSerializer
    http_method_names = ['get','post']
    
    def get_queryset(self):
        return Media.objects.filter(user=self.request.user)
    
