from Events.Engine.abstract_class import PageInfo from .bases import KeyValidations, cluster_name, KeyBases, PageBases, icon, KeyURLs from .account_records import ( AccountRecordsUpdateEventMethods, AccountRecordsCreateEventMethods, AccountRecordsListEventMethods, ) from .lang_models import ( account_language_create_models_as_dict, account_language_model_as_dict, account_language_list_models_as_dict, account_language_created_models_as_dict, account_language_update_form_models_as_dict, ) currentData = dict( NAME="AccountCluster", PREFIX="/accounts", URL="/dashboard?site=AccountCluster", ICON="Building", INFO={ "en": { "page": "Account Records for reaching user all types account information", }, "tr": { "page": "Kullanıcı tüm hesap bilgilerine ulaşmak için Hesap Kayıtları", }, }, SUBCATEGORIES={ "/accounts/create": { "SITE_URL": "/events/create?site=AccountCluster", "COMPONENT": "Link", "PREFIX_URL": "/accounts/create", "INFO": { "en": { "page": "Create Account Records", "actions": "Actions", "table": "Table", }, "tr": { "page": "Hesap Kayıdı Oluştur", "actions": "Aksiyonlar", "table": "Tablo", }, }, "INSTRUCTIONS": None, }, "/accounts/list": { "SITE_URL": "/events/dashboard?site=AccountCluster", "COMPONENT": "Table", "PREFIX_URL": "/accounts/list", "INFO": { "en": { "page": "List Account Records" }, "tr": { "page": "Hesap Kayıtlarını Listele" }, }, "INSTRUCTIONS": { "headers": { "store": True, "url": "/validations/header", "data": { "event_code": "/accounts/list", "asked_field": "headers", }, }, "data": { "store": True, "url": "/accounts/list", "data": { "page": 1, "limit": 1, "order_by": "uu_id", "order_type": "desc", "query": None, }, }, }, }, }, ) class ClustersPageInfo: # Cluster Page Infos that are available for the client dashboard_page_info = PageInfo( name=f"{cluster_name}", url=PageBases.DASHBOARD, icon=icon, page_info={ "en": { "page": "Account Records for reaching user all types account information", }, "tr": { "page": "Kullanıcı tüm hesap bilgilerine ulaşmak için Hesap Kayıtları", }, }, instructions={ str(KeyBases.list_key): { "headers": { "store": True, "url": KeyURLs.validations, "data": {"event_code": f"{KeyBases.list_key}", "asked_field": KeyValidations.headers}, }, "data": { "store": True, "url": f"{KeyBases.list_key}", "data": dict(page=1, limit=1), }, }, }, endpoints={ str(KeyBases.update_key): AccountRecordsUpdateEventMethods.retrieve_all_event_keys(), str(KeyBases.create_key): AccountRecordsCreateEventMethods.retrieve_all_event_keys(), str(KeyBases.list_key): AccountRecordsListEventMethods.retrieve_all_event_keys(), }, language_models={ str(KeyBases.list_key): { str(KeyBases.update_key): account_language_model_as_dict, str(KeyBases.create_key): account_language_created_models_as_dict, str(KeyBases.list_key): account_language_list_models_as_dict, } }, ) create_page_info = PageInfo( name=f"{cluster_name}", url=PageBases.CREATE, icon=icon, instructions={ str(KeyBases.create_key): { "validation": { "store": True, "url": KeyURLs.validations, "data": {"event_code": f"{KeyBases.create_key}", "asked_field": KeyValidations.validation }, }, "headers": { "store": True, "url": KeyURLs.validations, "data": {"event_code": f"{KeyBases.create_key}", "asked_field": KeyValidations.headers}, }, }, }, page_info={ "en": { "page": "Create Account Records for reaching user all types account information", }, "tr": { "page": "Kullanıcı tüm hesap bilgilerine ulaşmak için Hesap Kayıt Oluştur", }, }, endpoints={ str(KeyBases.create_key): AccountRecordsCreateEventMethods.retrieve_all_event_keys(), }, language_models={ str(KeyBases.create_key): account_language_create_models_as_dict, }, ) update_page_info = PageInfo( name=f"{cluster_name}", url=PageBases.UPDATE, icon=icon, instructions={ str(KeyBases.update_key): { "validation": { "store": True, "url": KeyURLs.validations, "data": {"event_code": f"{KeyBases.update_key}", "asked_field": KeyValidations.validation}, }, "headers": { "store": True, "url": KeyURLs.validations, "data": {"event_code": f"{KeyBases.update_key}", "asked_field": KeyValidations.headers}, }, }, }, page_info={ "en": { "page": "Update Account Records via all types account information", }, "tr": { "page": "Tüm hesap bilgileri aracılığıyla Hesap Kayıtlarını Güncelle", }, }, endpoints={ str(KeyBases.update_key): AccountRecordsUpdateEventMethods.retrieve_all_event_keys(), }, language_models={ str(KeyBases.update_key): account_language_update_form_models_as_dict, }, ) # Page Variations of the cluster page_infos = { ClustersPageInfo.dashboard_page_info.URL: ClustersPageInfo.dashboard_page_info, ClustersPageInfo.create_page_info.URL: ClustersPageInfo.create_page_info, ClustersPageInfo.update_page_info.URL: ClustersPageInfo.update_page_info, } # Check if all the page info is implemented in the mappings for t in [x for k, x in PageBases.__dict__.items() if not str(k).startswith("__")]: if t not in list(dict(page_infos).keys()): raise NotImplementedError(f"Page Info of : {t} is not implemented in mappings")