o
    i-                     @   s   d dl mZ d dlmZmZ d dlmZ d dlmZm	Z	 d dl
mZ d dlmZ d dlmZ dd	lmZ ed
dddeddidedgee	jgdd ZdS )    )render)api_viewpermission_classes)Response)statuspermissions)swagger_auto_schema)openapi)EstadoOportunidadVenta   ) EstadoOportunidadVentaSerializergetz&Listar estados de oportunidad de ventazDevuelve la lista de todos los estados de oportunidad de venta disponibles con sus atributos: id, nombre_estado, orden y es_final.   Tmany)methodoperation_summaryoperation_description	responsesGETc              
   C   sj   zt j }t|dd}t|jtjdW S  ty4 } ztddt	| itj
dW  Y d}~S d}~ww )zF
    Lista todos los estados de oportunidad de venta disponibles.
    Tr   )r   errorz-Error al obtener los estados de oportunidad: N)r
   objectsallr   r   datar   HTTP_200_OK	ExceptionstrHTTP_500_INTERNAL_SERVER_ERROR)requestestados
serializere r"   ;/var/www/html/crm_dreinet/estado_oportunidad_venta/views.pylistar_estados_oportunidad
   s   
r$   N)django.shortcutsr   rest_framework.decoratorsr   r   rest_framework.responser   rest_frameworkr   r   drf_yasg.utilsr   drf_yasgr	   Models.estado_oportunidad_ventar
   serializersr   IsAuthenticatedr$   r"   r"   r"   r#   <module>   s"    
