from django.utils.translation import gettext_lazy as _
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter, extend_schema
from rest_framework import status

from engine.core.docs.drf import BASE_ERRORS
from engine.payments.serializers import TransactionSerializer

TRANSACTION_SCHEMA = {
    "list": extend_schema(
        tags=[
            "payments",
        ],
        summary=_("list all transactions (read-only)"),
        responses={status.HTTP_200_OK: TransactionSerializer(many=True), **BASE_ERRORS},
    ),
    "retrieve": extend_schema(
        tags=[
            "payments",
        ],
        summary=_("retrieve a single transaction (read-only)"),
        parameters=[
            OpenApiParameter(
                name="uuid",
                location="path",
                description=_("Transaction UUID"),
                type=OpenApiTypes.UUID,
            ),
        ],
        responses={status.HTTP_200_OK: TransactionSerializer(), **BASE_ERRORS},
    ),
}
