# By: Riasat Ullah
# This file contains functions that will generate the context of analytics pages.

from constants import label_names as lbl
from translators import label_translator as lt


def tutorial_names_context(lang):
    '''
    Get the context for the tutorial names.
    '''
    page_labels = [lbl.tro_add_users, lbl.tro_analyze_incident_response,
                   lbl.tro_connect_monitoring_tools, lbl.tro_connect_your_chat, lbl.tro_connect_customer_support,
                   lbl.tro_create_services, lbl.tro_create_team_routine, lbl.tro_customize_notifications,
                   lbl.tro_download_mobile_app, lbl.tro_evaluate_team_stress_level, lbl.tro_incident_handling,
                   lbl.tro_keep_supervisors_informed, lbl.tro_map_system_dependencies, lbl.tro_scheduling_process,
                   lbl.tro_set_up_content_based_incident_handling, lbl.tro_set_up_escalation,
                   lbl.tro_set_up_live_call_routing, lbl.tro_suppress_unwanted_alerts]
    page_context = lt.get_context(page_labels, lang)
    return page_context


def progress_bar_context(lang):
    '''
    Get the context needed for the onboarding modal progress bar.
    '''
    page_labels = [lbl.ttl_add_users, lbl.ttl_create_escalation_policy, lbl.ttl_create_incident, lbl.ttl_create_routine,
                   lbl.ttl_create_service]
    page_context = lt.get_context(page_labels, lang)
    return page_context


def get_onboarding_welcome_context(lang):
    '''
    Context for the aggregate notifications analytics page.
    '''
    page_labels = [lbl.onb_application_programming_errors, lbl.onb_cannot_delegate_dynamically,
                   lbl.onb_catch_own_errors, lbl.onb_chat, lbl.onb_customer_support_unaware,
                   lbl.onb_customers_people_notify_us, lbl.onb_email, lbl.onb_escalation_none,
                   lbl.onb_find_contact_from_roster, lbl.onb_impact_visibility, lbl.onb_incident_delay,
                   lbl.onb_incoming_call_static, lbl.onb_incident_lose_track, lbl.onb_monitoring_applications,
                   lbl.onb_phone_call, lbl.onb_qq_how_are_incidents_detected,
                   lbl.onb_qq_how_are_incidents_notified, lbl.onb_qq_what_describes_an_incident,
                   lbl.onb_qq_what_problems_you_face, lbl.onb_responders_interrupted,
                   lbl.onb_schedule_manual, lbl.onb_skip_this, lbl.onb_start_onboarding, lbl.onb_starting_note,
                   lbl.onb_struggle_to_keep_managers_updated, lbl.onb_support_queries, lbl.onb_take_too_long_to_resolve,
                   lbl.onb_technical_issues, lbl.onb_ticket, lbl.onb_ttl_customer_internal_support,
                   lbl.onb_ttl_incident_management, lbl.onb_ttl_onboarding_guide, lbl.onb_ttl_on_call_management,
                   lbl.onb_welcome_to_taskcall]

    final_context = lt.get_context(page_labels, lang)
    return final_context


def get_onboarding_users_context(lang):
    '''
    Context for adding users in the onboarding flow.
    '''
    progress_context = progress_bar_context(lang)
    page_labels = [lbl.det_dont_show_anymore, lbl.ins_next, lbl.onb_enter_email_addresses,
                   lbl.onb_incident_auto_diagnostics, lbl.onb_incident_auto_escalate,
                   lbl.onb_incident_ensure_learn_immediately, lbl.onb_incident_impact_visibility,
                   lbl.onb_incident_inform_stakeholders, lbl.onb_incident_reduces_interruptions,
                   lbl.onb_intro_desc_business_services, lbl.onb_intro_desc_dependencies,
                   lbl.onb_intro_desc_escalation_policies, lbl.onb_intro_desc_incidents,
                   lbl.onb_intro_desc_integrations, lbl.onb_intro_desc_routines,
                   lbl.onb_intro_desc_services, lbl.onb_intro_css_inc_acknowledge, lbl.onb_intro_css_inc_dependencies,
                   lbl.onb_intro_css_inc_past_incidents, lbl.onb_intro_css_inc_reassign,
                   lbl.onb_intro_css_inc_reduce_interruption, lbl.onb_intro_css_inc_resolve,
                   lbl.onb_intro_css_inc_review, lbl.onb_intro_css_inc_run_diagnostics,
                   lbl.onb_intro_css_inc_similar_ongoing, lbl.onb_intro_css_inc_status_dashboard,
                   lbl.onb_intro_css_thats_all, lbl.onb_intro_starting_note,
                   lbl.onb_qq_how_taskcall_helps_resolve_incidents, lbl.onb_qq_what_is_an_incident, lbl.onb_skip_this,
                   lbl.ttl_business_services, lbl.ttl_dependencies, lbl.onb_ttl_digital_map_of_your_system,
                   lbl.onb_ttl_dynamic_on_call_management, lbl.ttl_escalation_policies, lbl.ttl_incident_response,
                   lbl.ttl_integrations, lbl.ttl_routines, lbl.ttl_services]
    final_context = {**progress_context, **lt.get_context(page_labels, lang)}
    return final_context


def get_onboarding_routine_context(lang):
    '''
    Context for creating routine in the onboarding flow.
    '''
    progress_context = progress_bar_context(lang)
    page_labels = [lbl.det_daily, lbl.det_name_the_routine, lbl.det_weekly, lbl.det_12_hours, lbl.det_24_hours,
                   lbl.ins_next, lbl.onb_qq_how_long_are_on_call_shifts, lbl.onb_qq_how_often_rotate_on_call,
                   lbl.onb_routine_add_others_later, lbl.onb_routine_dynamic_rotation]
    final_context = {**progress_context, **lt.get_context(page_labels, lang)}
    return final_context


def get_onboarding_escalation_policy_context(lang):
    '''
    Context for creating escalation policy in the onboarding flow.
    '''
    progress_context = progress_bar_context(lang)
    page_labels = [lbl.det_level, lbl.det_10_minutes, lbl.det_15_minutes, lbl.det_name_the_escalation_policy,
                   lbl.ins_next, lbl.onb_escalation_policy_auto_escalate,
                   lbl.onb_escalation_policy_choose_routine_or_user, lbl.onb_escalation_policy_two_levels_of_support]
    final_context = {**progress_context, **lt.get_context(page_labels, lang)}
    return final_context


def get_onboarding_service_context(lang):
    '''
    Context for creating service in the onboarding flow.
    '''
    progress_context = progress_bar_context(lang)
    page_labels = [lbl.ins_next, lbl.ins_no, lbl.ins_yes, lbl.det_10_minutes, lbl.det_15_minutes,
                   lbl.onb_qq_which_escalation_policy_for_service, lbl.onb_service_description_and_name,
                   lbl.onb_service_reduce_interruption, lbl.onb_service_retrigger_after]
    final_context = {**progress_context, **lt.get_context(page_labels, lang)}
    return final_context


def get_onboarding_integration_context(lang):
    '''
    Context for adding an integration to a service.
    '''
    progress_context = progress_bar_context(lang)
    page_labels = [lbl.onb_integration_add, lbl.onb_integration_chat, lbl.onb_integration_custom_actions,
                   lbl.onb_integration_email_or_external_platform, lbl.onb_integration_run_jobs,
                   lbl.onb_service_set_up_email_integration, lbl.ttl_add_integration]
    final_context = {**progress_context, **lt.get_context(page_labels, lang)}
    return final_context


def get_onboarding_incident_context(lang):
    '''
    Context for creating incident in the onboarding flow.
    '''
    progress_context = progress_bar_context(lang)
    page_labels = [lbl.det_create_test_incident, lbl.det_email_and_push_notifications, lbl.det_sms_notification,
                   lbl.det_voice_call_notification, lbl.dsm_by_api_call, lbl.dsm_by_email,
                   lbl.dsm_by_integration, lbl.dsm_documentation, lbl.ins_done, lbl.ins_got_it,
                   lbl.onb_incident_copy_curl_command, lbl.onb_incident_created_critical,
                   lbl.onb_incident_notf_ext_one, lbl.onb_incident_notf_ext_two, lbl.onb_incident_notf_ext_three,
                   lbl.onb_incident_respond_by_sms_and_voice_call, lbl.onb_incident_notf_ext_regulations,
                   lbl.onb_incident_save_api_key, lbl.onb_incident_select_integration, lbl.onb_incident_send_email,
                   lbl.onb_to_do_list_desc]
    final_context = {**progress_context, **lt.get_context(page_labels, lang)}
    return final_context
