o
    :gi                     @   sr   d dl Z d dlmZ d dlmZ ddlmZ ee j	d Z
ee
d  dd	 Zdd
dZedkr7ee dS )    N)Path)load_dotenv   )build_config   z.envc                  C   s  t d} | d | d | d | d | d | jdt jd d | jd	td
 | jddd | jddd | jddd | jdddd | jdddd | jdddd | jdddd | jddg dd | jd dd!d | jd"dd#d | jd$dd%d | jd&dg d'd | jd(dg d)d | jd*dg d+d | jd,dg d-d | jd.d/d0}|d1 |d2 |jd3d4d5 |jd6d7d5 |jd8d9d5 |jd:d;d5 |jd<d=d5 | S )>NzAroFlo UI Automationz
--base-urlz
--usernamez
--passwordz--state-filez--artifacts-dirz
--headless)actiondefaultz--slow-mo-ms)typez--step
store_true)r   z--pause-on-mfaz
--mfa-code )r   z--timesheet-datez-Target date for Daily Timesheet in YYYY-MM-DD)r   helpz--timesheet-buzGBusiness Unit name to select in AroFlo (e.g. 'Utility Solutions Group')z--delete-allz=Delete ALL existing entries in the selected date (hours -> 0))r   r   z--include-protectedzCAlso delete protected rows like Lunch Break (use with --delete-all)z--rowappendzTimesheet row spec. Repeatable.)r   r   r   z--timesheet-user-idz:AroFlo User ID to select in Timesheets (preferred, unique)z--timesheet-user-namezDAroFlo User full name to select in Timesheets (fallback, non-unique)z--user-emailz=Email del usuario a buscar en Users (ej: cpenuela@usg.com.au)z--filezkRuta de archivo a adjuntar en el perfil del usuario (repeatable). Ej: --file /path/a.pdf --file /path/b.jpgz	--commentuH   Comment para el documento (repeatable, se mapea con --file por índice).z--filteru   Filter para el documento (repeatable, se mapea con --file por índice). Opciones: Internal Only | Internal Admin Only (Legacy) | Internal Admin and Manager Only (Legacy) | Show Client | Show Contractor | Show Allz--doczTripleta repetible. Ej: --doc "file=/path/a.pdf;comment=uno;filter=Internal Only" --doc "file=/path/b.jpg;comment=dos;filter=Show Contractor"cmdT)destrequired	bootstrapsmoketimesheet-navz+Navigate: Dashboard -> Manage -> Timesheets)r   timesheet-createz*Create a timesheet entry via UI automationtimesheet-deletez4Delete timesheet entries (hours=0) via UI automation	users-navz&Navigate: Dashboard -> Manage -> Usersusers-upload-docsz6Users: open profile by email and upload 1..N documents)argparseArgumentParseradd_argumentBooleanOptionalActionintadd_subparsers
add_parser)psub r!   L/var/www/html/flask_server/apps/aroflo_connector_app/ui_automation/runner.pybuild_parser   sD   








r#   c           
      C   s   t  | }t|}|jdkrddlm} |||jS |jdkr*ddlm} ||S |jdkr9ddl	m
} ||S |jdkrHdd	lm} ||S |jd
krWddlm} ||S |jdkrfddlm} ||S |jdkrwddlm}	 |	||jS td)Nr   r   )cmd_bootstrapr   )	cmd_smoker   )cmd_timesheet_navr   )cmd_timesheet_creater   )cmd_timesheet_deleter   )cmd_users_navr   )cmd_users_upload_documentszUnknown command)r#   
parse_argsr   r   commands.bootstrapr$   mfa_codecommands.smoker%   commands.timesheet_navr&   commands.timesheet_creater'   commands.timesheet_deleter(   commands.users_navr)   commands.users_upload_documentsr*   
SystemExit)
argvargscfgr$   r%   r&   r'   r(   r)   r*   r!   r!   r"   main?   s0   






r8   __main__)N)r   pathlibr   dotenvr   core.configr   __file__resolveparents	CORE_ROOTr#   r8   __name__r4   r!   r!   r!   r"   <module>   s   
2$
