a
    .im;                     @   s   d dl mZmZ ddlmZ G dd deZG dd deZG dd	 d	eZG d
d deZG dd deZ	G dd deZ
G dd deZG dd deZdS )    )EnumIntEnum   )PortalLayerc                   @   s    e Zd ZdZdZdZdd ZdS )UserRoler      
   c                 C   s6   | t jkrdS | t jkrdS | t jkr*dS tdd S )NZStandardZAdminZDemozUnexpected User Role type.)r   STANDARDADMINDEMO
ValueErrorself r   f/var/www/staging/api/virtual_environments/venv/lib/python3.9/site-packages/main/services/enums/user.py__str__   s    


zUserRole.__str__N)__name__
__module____qualname__r	   r   r
   r   r   r   r   r   r      s   r   c                   @   s,   e Zd ZdZdZdZdZdZdZdd Z	d	S )
	AdminRoler   r               c                 C   s0   t jdt jdt jdt jdt jdt jdi}||  S )NsystemZinsaruserorderregionZwebsite)r   SYSTEMINSARUSERORDERREGIONWEBSITE)r   Z	role_dictr   r   r   r      s    zAdminRole.__str__N)
r   r   r   r   r   r    r!   r"   r#   r   r   r   r   r   r      s   r   c                   @   s(   e Zd ZdZdZdd Zedd ZdS )ApiResourceZreportsZvels_tsc                 C   s   | j S Nvaluer   r   r   r   r   ,   s    zApiResource.__str__c                 C   s   t jdt jdi}||  S )NZReportszVelocities and Time Series)r$   REPORTS
INSAR_DATAr   Z
label_dictr   r   r   label/   s    zApiResource.labelN)r   r   r   r(   r)   r   propertyr+   r   r   r   r   r$   (   s
   r$   c                   @   s    e Zd ZdZdZdZdZdZdS )OrderClientStatusZOpen
ProcessingZComplete	CancelledZPendingN)r   r   r   OPEN
PROCESSINGCOMPLETE	CANCELLEDPENDINGr   r   r   r   r-   7   s
   r-   c                   @   sr   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZedd Zedd Zedd ZeedddZdS )OrderStatusr   r                        2   3   A   c                 C   s  | t jkrg S t jt jt jt jt jgt jt jt jt jgt jt jt jt jt jt j	gt jt jt jt jgt jt jt j
t j	t jt jgt jt j
t j	t jt jgt jt j
t j	t jt jt jt jgt j
t jt jt j	gt j	t jgt jt j	t jgt jt jt j	t j
t jgi}||  t jg S r%   )r5   r3   INITIALISEDDATA_SELECTEDPAYMENT_PENDINGCARD_PAYMENT_STARTEDCARD_PAYMENT_CANCELLEDCHECKOUT_SUCCESS_PAGE_HITCARD_PAYMENT_SUCCESSFULFILLED_SUB_ACTIVEFULFILLED_DOWNLOAD_AVAILABLEFULFILLED_SUB_CANCELLEDDATA_BEING_EXTRACTED)r   Ztransition_dictr   r   r   allowable_transitionsM   s    

z!OrderStatus.allowable_transitionsc                 C   sT   t jdt jdt jdt jdt jdt jdt jdt jdt j	d	t j
d
t jdt jdi}||  S )NZInitialisedzData SelectedzCard Payment StartedzCard Payment CancelledzCheckout Success Page HitzCard Payment SuccesszData Being ExtractedzFulfilled Download Availabler/   z!Complete, and Subscription Activez$Complete, and Subscription CancelledzPayment Pendingr5   r@   rA   rC   rD   rE   rF   rJ   rH   r3   rG   rI   rB   r*   r   r   r   r+   b   s    zOrderStatus.labelc                 C   sT   t jdt jdt jdt jdt jdt jdt jdt jdt j	d	t j
d
t jdt jdi}||  S )NzaUser has submitted an area of interest but has not chosen the data they would like for that area.zAUser has submitted the types of data they would like to download.z&User has started card payment process.zUUser has attempted to pay by card but they quit the process, or something went wrong.z#User has hit success checkout page.z-User has successfully paid for order by card.zUAn admin has assigned themself to the order and is extracting the data for the order.zPThe order has been fulfilled - the user can download their data from the portal.zjThe order has been cancelled.  Any monies should have been refunded and the user cannot access their data.z=The Order has been completed, and has an active subscription.z=The Order has been completed, and the subscription cancelled.zQUser has started the order, generated a quote and will manually make the payment.rL   r   Zdescription_dictr   r   r   descriptiont   s    zOrderStatus.descriptionreturnc                 C   sb   | t jt jt jt jfv rtjS | t jt jt j	fv r8tj
S | t jkrHtjS | t jkrXtjS tjS d S r%   )r5   r@   rA   rC   rD   r-   r0   rH   rG   rI   r2   r3   rB   r4   r1   r   r   r   r   client_status   s     

zOrderStatus.client_statusN)r   r   r   r@   rA   rC   rD   rE   rF   rJ   rH   rG   r3   rI   rB   r,   rK   r+   rN   r-   rQ   r   r   r   r   r5   >   s(   


r5   c                   @   sN   e Zd ZdZdZdZdZdZdZdZ	dd	 Z
eed
ddZedd ZdS )
DataFormatr   r   r   r   r   r   r   c                 C   s
   t | jS r%   )strr'   r   r   r   r   r      s    zDataFormat.__str__r&   c                 C   s   t t| S r%   )rR   intr&   r   r   r   parse   s    zDataFormat.parsec                 C   s6   t jdt jdt jdt jdt jdt jdt jdi}||  S )NCSVZGeoJSON	SHAPEFILEZGeotiffZSatShopZEmailPDF)rR   rV   GEOJSONrW   GEOTIFFPORTALEMAILrX   r*   r   r   r   r+      s    	zDataFormat.labelN)r   r   r   rV   rY   rW   rZ   r[   r\   rX   r   staticmethodrS   rU   r,   r+   r   r   r   r   rR      s   rR   c                   @   s   e Zd ZdZdZdZdZdZdZdZ	dZ
d	d
 ZdddZeedddZeedddZedd Zedd Zdd Zedd Zedd Zedd ZdS ) ProductZts_velsupgradecsvZ	shapefileZ
int_reportZongoing_accessalertZlayersc                 C   s*   dd t D }|| }||}||k S )Nc                 S   s   g | ]}|qS r   r   ).0xr   r   r   
<listcomp>       z"Product.__lt__.<locals>.<listcomp>)r^   index)r   otherZproduct_enum_orderingZself_ixZother_ixr   r   r   __lt__   s    

zProduct.__lt__Nc                 C   s8   | j | j| j| j| j| j| jd}|r4| ||d< |S )N)keynametitletextsubscriptionZ
selectabledisplay_priceprice)r'   rj   r+   rl   rm   user_selectablern   ro   )r   
base_priceoutputr   r   r   labels   s    	zProduct.labelsrO   c                 C   s<   t jdt jdt jdt jdt jdt jdt jdt jdi}||  S )	Nz0Time Series and Average Movement Rate (Velocity)rV   Z	ShapefilezOngoing AccesszInterpretation ReportZAlertszUpgrade monthzAdditional Datasets	r^   TIME_SERIES_AND_VELSrV   rW   ONGOING_ACCESSINTERPRETATION_REPORTALERTUPGRADELAYERS)r   Z	name_dictr   r   r   r+      s    
zProduct.labelc                 C   s<   t jdt jdt jdt jdt jdt jdt jdt jdi}||  S NTFrt   )r   Zrequires_orbits_dictr   r   r   requires_orbits   s    
zProduct.requires_orbitsc                 C   sL   t jtjt jtjt jtjt jtjt jtjt j	tj
t jtjt jtji}||  S r%   )r^   ru   rR   rV   rW   rv   r[   rw   rX   rx   r\   ry   rz   )r   Zdata_format_dictr   r   r   data_format   s    
zProduct.data_formatc                 C   s<   t jdt jdt jdt jdt jdt jdt jdt jdi}||  S NFTrt   )r   Zsubscription_dictr   r   r   rm      s    
zProduct.subscriptionc                 C   sd   t t|d}tj|tjdtjdtj|d tj|d tj|d tj	|d tj
di}t t||  dS )Nr   r   r=   gQ?g      ?g?)floatroundr^   ru   rV   rW   rv   rw   rx   ry   rz   )r   rq   Z
price_dictr   r   r   ro     s    




zProduct.pricec                 C   s<   t jdt jdt jdt jdt jdt jdt jdt jdi}||  S )	NzFIncludes all historical data currently available up to the Order date.z3A CSV download of the data included with the Order.z8Receive the data in shapefile format in addition to CSV.zSubscribe to ongoing access to your data, which will be updated every 6 - 12 days with each satellite overpass.  Minimum subscription period of 1 month.zOAdd an Interpretation Report - please contact us for more details and examples.zDSubscribe to configurable alerts to be notified of changes by email.zxBring the data for this area up to date by purchasing the new data that has been acquired since the original Order date.zAdd extra layers to your order.  Layers include CSK, TSX and rural.  We will be in touch to confirm details and price if this option is selected.rt   rM   r   r   r   rl     s    
zProduct.textc                 C   s<   t jdt jdt jdt jdt jdt jdt jdt jdi}||  S r~   rt   )r   Zuser_selectable_dictr   r   r   rp   *  s    
zProduct.user_selectablec                 C   s<   t jdt jdt jdt jdt jdt jdt jdt jdi}||  S r{   rt   )r   Zdisplay_price_dictr   r   r   rn   8  s    
zProduct.display_price)N)r   r   r   ru   ry   rV   rW   rw   rv   rx   rz   rh   rs   r,   rS   r+   boolr|   r}   rm   ro   rl   rp   rn   r   r   r   r   r^      s2   




r^   c                   @   s`   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zed
d Zedd Zedd Zedd ZdS )EventCategoryr   r   r   r   r            r:   c                 C   s   | j | j| j| jdS )Nacknowledgeabledisplay_namerj   r'   r   r   r   r   r   to_dictS  s
    zEventCategory.to_dictc                 C   s$   | t jt jt jt jt jfv r dS dS r{   )r   ACCESS_REQUESTREGISTRATIONr!   CONTACTFEEDBACKr   r   r   r   r   \  s    zEventCategory.acknowledgeablec                 C   sB   t jdt jdt jdt jdt jdt jdt jdt jdt j	d	i	}||  S )
NAPI RequestSatbotSystem
DeploymentOrderzUser AccesszUser RegistrationzContact FormzFeedback Form
r   API_REQUESTSATBOTr   APP_DEPLOYEDr!   r   r   r   r   r   Zchannel_dictr   r   r   r   g  s    zEventCategory.display_namec                 C   sF   t jdt jdt jdt jdt jdt jdt jdt jdt j	d	i	}d
||  iS )Nr   r   r   r   r   zNew User Access RequestzNew User RegistrationzNew contact form messagezNew feedbackmessager   r   r   r   r   public_datav  s    zEventCategory.public_dataN)r   r   r   r   r   r   r   r!   r   r   r   r   r,   r   r   r   r   r   r   r   r   r   G  s"   



r   N)enumr   r   layerr   r   r   r$   r-   r5   rR   r^   r   r   r   r   r   <module>   s   [ 