o
    7oj                     @  sX  d Z ddlmZ ddlZddlZddlmZmZ ddlmZ ee	
 jd Zejdee ejdZedurCeedsCejd= dd	lmZ dd
lmZ ddlmZmZmZmZmZmZ dddddddddddddddddddddddddd d!d"d#dd$d%d&d'dd(d)d*d'dd+Zh d,Z d-d.d/d0Z!d6d3d4Z"e#d5kre$e" dS )7zESeed the non-billable Stripe-preview trial for the AbsoluteMS tenant.    )annotationsN)datetime	timedelta)Path   platform__path__)select)get_control_plane_session)AppPlanTenant	TenantAppTenantLimitTenantSubscriptionzWP Invoicesz/api/v1/wp_invoicesz&Digitise and analyse invoices with AI.zAI & Finance)nameroutedescriptioncategoryz
ABN Lookupz/api/v1/abn_lookup_appz.Look up Australian business registration data.zBusiness DatazLeave Formsz/api/v1/leave_form_appz,Manage leave requests and related workflows.	WorkforcezAroFlo Connectorz/api/v1/aroflo_connector_appz'Connect authorised workflows to AroFlo.IntegrationszInvoice Mail Intakez/api/v1/wp_invoices_mail_appz3Process invoice messages through a managed mailbox.zVoice Orderingz/api/v1/voiceordering_appz-Capture product orders using voice workflows.OrderingzMessaging Servicez/api/v1/messaging_servicezDDeliver controlled SMS and email templates through tenant providers.zPlatform Servicesz
QR Servicez/api/v1/qr_servicez1Create and resolve generic revocable QR contexts.)wp_invoicesabn_lookup_appleave_form_apparoflo_connector_appwp_invoices_mail_appvoiceordering_appmessaging_service
qr_service>   r   r   r   r   r   r   )i   Nblock)i Nr    )x   <   r    )
storage_mbai_tokens_monthlyrequests_per_minutereturnintc                  C  s  t  } t 9}|td}|d u rtd|td}|d u r0tddddddd}|| d|_t	
 D ]:\}}|t|}|d u rZt||d	 d
| |d dd}|| |d	 |_|d |_d|_|d |d d|_q7|tttj|jkd }|d u rtd|jdd}|| d|_d|_d |_d |_d|_| |_| tdd |_d|_dddd|_tD ]1}|tt t j|jkt j!|kd }|d u rt |j|d}|| d|_"ddi|_#qt$
 D ]C\}	\}
}}|tt%t%j|jkt%j!&d t%j'|	kd }|d u r't%|jd |	d}|| |
|_(||_)||_*dd i|_q|+  W d    n	1 sEw   Y  t,t-j.d!ddddt/td"d# t$
 D d$d%d& dS )'N
absolutemsz Tenant absolutems does not existdevDevelopmentr   AUDz?Development subscription used for platform integration testing.)plan_idcoder   price_monthlycurrencyr   r   zapps.r   T)app_iddisplay_namemodule_pathroute_prefix	is_activer   r   )r   r   r   zabsolutems-dev)subscription_id	tenant_idr,   stripetrialing   )daysF phase_2_stripe_integration_trialpending_prices)purposebilling_statebillable)r6   r0   enabled)r6   r0   
limit_namesourcedevelopment_seedokc                 S  s   i | ]	\}}||d  qS )r    ).0r   valuerE   rE   'scripts/seed_absolutems_entitlements.py
<dictcomp>   s    zmain.<locals>.<dictcomp>)statustenantsubscriptionproviderr?   enabled_appslimits   )indent)0r   utcnowr
   getr   RuntimeErrorr   addr,   APP_CATALOGitemsr   r1   r3   r4   metadata_jsonexecuter	   r   wherer6   limitscalar_one_or_nonerM   provider_customer_idprovider_subscription_idrJ   current_period_startr   current_period_endcancel_at_period_endENABLED_APPSr   r0   
is_enabledconfig_jsonDEFAULT_LIMITSr   is_rA   limit_valuewindow_secondsoverage_policycommitprintjsondumpssorted)nowsessionrK   planr0   
definitionapprL   bindingr   rG   windowpolicyr[   rE   rE   rH   main_   s   










	

c	rw   __main__)r&   r'   )%__doc__
__future__r   rl   sysr   r   pathlibr   __file__resolveparentsBASE_DIRpathinsertstrmodulesrS   loaded_platformhasattr
sqlalchemyr	   config.control_planer
   platform.tenants.modelsr   r   r   r   r   r   rV   rb   re   rw   __name__
SystemExitrE   rE   rE   rH   <module>   s    3	
v
