o
    Fg%                     @   sF   d dl mZ d dlmZ d dlmZ d dlmZ edgdd ZdS )	    )api_view)Responsestatus)	CustomersPOSTc                 C   s   | j dkrTz;d| jv rtjj| jd d}nd| jv r&tjj| jd d}n
tdditjdW S d	|_|	  tdd
itj
dW S  tjyS   tdditjd Y S w tdditjdS )Nr   customer_id)pkqr_code)r
   messagezInvalid request.r   Fz!Account deactivated successfully.zCustomer not found.)methoddatar   objectsgetr   r   HTTP_400_BAD_REQUEST	is_activesaveHTTP_200_OKDoesNotExistHTTP_404_NOT_FOUND)requestcustomer r   C/var/www/rescue_company/customer_api/views/deactivate_on_request.pydeactivate_account   s   


r   N)	rest_framework.decoratorsr   rest_framework.responser   rest_frameworkr   customer_api.modelsr   r   r   r   r   r   <module>   s    