from rest_framework.decorators import api_view
from rest_framework.request import Request
from rest_framework.response import Response


@api_view(['PATCH'])
def change_password(request: Request, *args, **kwargs):
    from users.interfaces.change_password import as_view

    ret = as_view(request, *args, **kwargs)
    return Response(ret.data or ret.messages, status=ret.status_code)


@api_view(['PATCH'])
def change_username(request: Request, *args, **kwargs):
    from users.interfaces.change_username import as_view

    ret = as_view(request, *args, **kwargs)
    return Response(ret.data or ret.messages, status=ret.status_code)


@api_view(['PATCH'])
def change_phone_number(request: Request, *args, **kwargs):
    from users.interfaces.change_phone_number import as_view

    ret = as_view(request, *args, **kwargs)
    return Response(ret.data or ret.messages, status=ret.status_code)


@api_view(['PATCH'])
def change_email_address(request: Request, *args, **kwargs):
    from users.interfaces.change_email_address import as_view

    ret = as_view(request, *args, **kwargs)
    return Response(ret.data or ret.messages, status=ret.status_code)
