from rest_framework import viewsets
from .models import Product, PriceType, PriceList, Discount, PriceChangeHistory, PriceTag, DiscountHistory, PriceListWithDiscount
from .serializers import (
    ProductSerializer, PriceTypeSerializer, PriceListSerializer, DiscountSerializer,
    PriceChangeHistorySerializer, PriceTagSerializer, DiscountHistorySerializer, PriceListWithDiscountSerializer
)

# ViewSet для модели Product
class ProductViewSet(viewsets.ModelViewSet):
    queryset = Product.objects.all()
    serializer_class = ProductSerializer

# ViewSet для модели PriceType
class PriceTypeViewSet(viewsets.ModelViewSet):
    queryset = PriceType.objects.all()
    serializer_class = PriceTypeSerializer

# ViewSet для модели PriceList
class PriceListViewSet(viewsets.ModelViewSet):
    queryset = PriceList.objects.all()
    serializer_class = PriceListSerializer

# ViewSet для модели Discount
class DiscountViewSet(viewsets.ModelViewSet):
    queryset = Discount.objects.all()
    serializer_class = DiscountSerializer

# ViewSet для модели PriceChangeHistory
class PriceChangeHistoryViewSet(viewsets.ModelViewSet):
    queryset = PriceChangeHistory.objects.all()
    serializer_class = PriceChangeHistorySerializer

# ViewSet для модели PriceTag
class PriceTagViewSet(viewsets.ModelViewSet):
    queryset = PriceTag.objects.all()
    serializer_class = PriceTagSerializer

# ViewSet для модели DiscountHistory
class DiscountHistoryViewSet(viewsets.ModelViewSet):
    queryset = DiscountHistory.objects.all()
    serializer_class = DiscountHistorySerializer

# ViewSet для модели PriceListWithDiscount
class PriceListWithDiscountViewSet(viewsets.ModelViewSet):
    queryset = PriceListWithDiscount.objects.all()
    serializer_class = PriceListWithDiscountSerializer
