from rest_framework import status
from rest_framework.response import Response


class SoftDeleteMixin:
    def destroy(self, request, pk=None, *args, **kwargs):
        """ override destroy -> soft delete """

        instance = self.get_object()  # noqa
        print("soft delete mixin")
        instance.soft_delete()
        return Response(
            {"detail": "رکورد با موفقیت حذف شد (Soft Delete)."},  # noqa
            status=status.HTTP_204_NO_CONTENT
        )
