a
    i[                      @   s  d Z ddlZddlT ddlT eeZddlmZm	Z	m
Z
mZmZmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZ ddlmZmZm Z  ddl!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4 ddl5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZP dd	lQmRZRmSZSmTZTmUZUmVZV dd
lWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZa ddlbmcZcmdZdmeZemfZfmgZgmhZhmiZimjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrmsZsmtZtmuZumvZv ddlwmxZxmyZymzZzm{Z{m|Z|m}Z}m~Z~mZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZmZmZmZmZ ddlmZmZ ddlZddlZdZdd Zdd Zed ed dS )a7  
BaoLife Functions Module - Refactored Structure

This module serves as the main entry point and backward compatibility layer
for all game functions. The code has been refactored into logical modules:

- database/ - Database operations and save/load functions
- core/ - Core model classes (playerClass, personClass, etc.)
- character/ - Character creation, management, and appearance
- relationships/ - Relationship management and dating
- education/ - School, college, and extracurricular management
- jobs/ - Occupation and career management
- health/ - Health, habits, and weight management
- stats/ - Stats updates, moods, finances, and event checking
- shop/ - Store items and purchases
- utils/ - Helper functions and game speed validation

For backward compatibility, all functions are re-exported from this module.
    N)*)
connect_to_databaseget_database_connection
insertGamesaveGamesaveGameAsyncloadGameloadGameAsync	loadGamessaveConversationMessagemarkConversationAsRead)
locationClassActivityRecordEducationRecord
dailyEventplayerClasspersonClassoneTimeEventscheduleDays	schedulerrelationshipClass)validate_game_speedget_speed_button_valueslog_speed_change)getFromArray	randArray
find_by_id
find_wherefindCharactersfindfind_where_testrandremove_text_before_first_colonordinal_suffix
getWeekDayupcoming_saturday
get_seasongenerate_random_dateparseLocationsgetOppositeSexcreate_jwt_token_unpickle_health_condition_reduce_health_condition)setBirthdaygetPersonDescriptiongetOpenAIDescription
set_avatarget_lastnameget_firstnameget_partner	add_childget_youngestChildadd_parentsadd_older_siblingsadd_grandparents
add_friendget_random_classmateget_random_friendget_random_characterget_random_familyget_allFamilycreate_charactercreate_classmatescreate_coworkers
get_personget_relationshipupdate_relationship	updateBio	setValuescharacterSetup)get_hair_colorget_hair_typeget_facial_hairget_accessoryget_skin_color)
updateAffinityhandleRelationships
getRelDataromancegetActiveRelationshipbreakUppartnerGift	dateNightDateIdeagetDateIdeas)ElementarySchoolClassHighSchoolClassCollegeClassCollegeMajorClass
FocusClassExtraCurricular
getSchoolsgetColleges	getMajors
getFocusesrandomFocusupdate_focusgetFocusgetExtraCurricularsrandomExtraCurricularsetEducationhandleEducationsetExtracurricularapplyForExtracurricularquitExtraCurricular)JobLevelOccupationClassgetOccupations	randomJobsetJob	handleJobapplyForJobquitJob)
HabitClassHealthCondition	setHabits	quitHabitstopQuitHabithandleHabitChangesgetWeightTypehandleWeighthandleHealthhandleDeathhandleHunger	mealEventupdateDeathChancegetHealthConditions)connectcheckDilemmascheckEventscheckDayEventscheckTutorialEventsscheduleComplete	updateAgesetLikesDislikeshandleUpdatesparseOneTimeEventshandleMoodshandleFinancesgetPeakEnergy)	StoreItemInAppPurchaseItemgetStoreItemspurchaseItemgetInAppPurchaseItemspurchaseInAppItem)get_dailyPlangetIntradayActivityzlichun.lichunWebsocketc              	      s   t d|  d |  ddtdt  d}d|dd	i}d
|  }tjdd4 I d H F}|j|||dI d H }t |j|j |j|jfW  d   I d H  S 1 I d H s0    Y  d S )Nzsending push notification for z with message 010zbearer )zapns-expirationzapns-priorityz
apns-topicauthorizationZapsdefault)ZalertZsoundz0https://api.development.push.apple.com/3/device/T)Zhttp2)headersjson)print	BUNDLE_IDr*   httpxZAsyncClientpoststatus_codecontent)Zdevice_tokenmessager   Zpayload_dataurlclientresp r   */var/www/lichun.app/lichun/ws/functions.pysend_push_notification  s     

r   c                    sn   t dddkrjddlm} ddlm} || }|| |I d H  td t| jd|j	 d|j
 I d H  d S )Nr   d   )sendCharacterMessage)r<   zattempting notificationzNew message from  )randomrandintconversationEventsr   	functionsr<   r   r   ZdeviceToken	firstnamelastname)playerr   r<   	characterr   r   r   sendRandomCharacterMessage  s    r   z>Functions module loaded successfully with refactored structureznAll submodules imported: database, core, character, relationships, education, jobs, health, stats, shop, utils)__doc__logging	dayEventsevents	getLogger__name__loggerZdatabase.db_operationsr   r   r   r   r   r   r	   r
   r   r   Zcore.modelsr   r   r   r   r   r   r   r   r   r   Zutils.game_speedr   r   r   Zutils.helpersr   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   Zcharacter.character_managerr-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   Zcharacter.appearancerH   rI   rJ   rK   rL   Z"relationships.relationship_managerrM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   Zeducation.education_managerrW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   Zjobs.job_managerrk   rl   rm   rn   ro   rp   rq   rr   Zhealth.health_managerrs   rt   ru   rv   rw   rx   ry   rz   r{   r|   r}   r~   r   r   Zstats.stats_managerr   r   r   r   r   r   r   r   r   r   r   r   r   Zshop.shop_managerr   r   r   r   r   r   intradayActivityr   r   r   r   r   r   r   infodebugr   r   r   r   <module>   s0   
00	Tt!0X(@< 
