from rest_framework import generics
from rest_framework.permissions import AllowAny
from .models import HomeBanner
from .serializers import HomeBannerSerializer


class HomeBannerListAPIView(generics.ListAPIView):
    """API view to get all active home banners"""
    queryset = HomeBanner.objects.filter(is_active=True).order_by('display_order', 'created_at')
    serializer_class = HomeBannerSerializer
    permission_classes = [AllowAny]


class HomeBannerDetailAPIView(generics.RetrieveAPIView):
    """API view to get a specific home banner"""
    queryset = HomeBanner.objects.filter(is_active=True)
    serializer_class = HomeBannerSerializer
    permission_classes = [AllowAny]

