from rest_framework.viewsets import ReadOnlyModelViewSet

from core.permissions import EvibesPermission, IsOwner
from payments.serializers import TransactionSerializer


class TransactionViewSet(ReadOnlyModelViewSet):
    """
    ViewSet for handling read-only operations on the Transaction model.

    This class provides a read-only interface for interacting with transaction
    data. It uses the TransactionSerializer for serializing and deserializing
    the data. The class ensures that only authorized users, who meet specific
    permissions, can access the transactions.

    Attributes:
        serializer_class: Specifies the serializer class to be used for
            serializing transaction data.
        permission_classes: A tuple specifying the permissions required to access
            the data. Includes custom permissions to restrict access based
            on ownership and other criteria.
    """

    serializer_class = TransactionSerializer
    permission_classes = (EvibesPermission, IsOwner)
