#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os.path
from .logs import LoggerConfig
from .defaultpath import DATA_ROOT
from .defaultpath import PROJECT_ROOT
from .defaultpath import SOURCE_ROOT 
from .defaultpath import LOG_ROOT

class Values(object):
    """
    Global variables is defined here.
    """
    project_root = PROJECT_ROOT
    source_root = SOURCE_ROOT
    data_root = DATA_ROOT
    log_root = LOG_ROOT
    _apidata_app_data_path = os.path.join(data_root,"appdata")

    sensitive_api_infos = "sensitive_api_infos.db"
    sensitive_api_infos_path = os.path.join(_apidata_app_data_path,sensitive_api_infos)

    drebin_179f_1500_appsinfo_txt = "drebin_179f_1500_appsinfo.txt"
    drebin_179f_1500_appsinfo_txt_path = os.path.join(_apidata_app_data_path,drebin_179f_1500_appsinfo_txt)

    drebin_179f_1500_appsinfo = "drebin_179f_1500_appsinfo.db"
    drebin_179f_1500_appsinfo_path = os.path.join(_apidata_app_data_path,drebin_179f_1500_appsinfo)

    fdroid_28_9_2018 = "fdroid_28_9_2018.db"
    fdroid_28_9_2018_path = os.path.join(_apidata_app_data_path,fdroid_28_9_2018)

    memhook = "memhook.txt"
    memhook_path = os.path.join(_apidata_app_data_path,memhook)


    dy_result_paths = ['/home/Research/tools/results/malware', '/home/Research/tools/results/fdroid']
    record_pkgs_dump_path = os.path.join(_apidata_app_data_path,'record_pkgs_dump.txt')
    record_pkgs_path = os.path.join(_apidata_app_data_path,'record_pkgs.txt')

    screen_api_flow_no_screen_path = os.path.join(log_root,'screen_api_flow_no_screen.txt')
    screen_api_flow_db = os.path.join(_apidata_app_data_path,'screen_api_flow_db_filter_3.0.db')

    syspkgs = set(line.strip() for line in open(os.path.join(_apidata_app_data_path,'syspkgs.txt')))


    image_to_string_db = os.path.join(_apidata_app_data_path,'image_to_string_db.db')

    # > log_init
    log_init_config = LoggerConfig.config
    # < log_init

    # > resources
    __data_resources_path = os.path.join(data_root, "resources")
    # >> android_class_description_dict
    android_class_description_dict = os.path.join(
        __data_resources_path, "android_class_description_dict.json")
    # >> android_package_list
    android_package_list = os.path.join(
        __data_resources_path, "android_package_list.txt")
    # >> sorted_words
    sorted_words = os.path.join(
        __data_resources_path, "words_sorted_by_frequency.txt")
        # >> stopwords
    stopwords_path = os.path.join(__data_resources_path, "stopwords.txt")
    # >> sensitive_class_info_path
    sensitive_class_info_path = os.path.join(
        __data_resources_path, "sensitive_class_info_path.json")


       # > word2vec
    __data_word2vec_path = os.path.join(data_root, "word2vec")
    __data_word2vec_path = __data_word2vec_path.replace('apicogdata','apidata')
    word2vec_model_path = os.path.join(__data_word2vec_path, "wiki.en.text.model")
    # > stanford
    __data_stanford_path = os.path.join(data_root, "stanford")
    __data_stanford_path = __data_stanford_path.replace('apicogdata','apidata')
    # >> stanford corenlp
    stanford_corenlp_dir = os.path.join(
        __data_stanford_path, "stanford-corenlp-full")

    # > module inputs
    __data_demo_inputs_path = os.path.join(data_root, "demo_inputs")

    monitor_recorded_apis_path = os.path.join(
        __data_demo_inputs_path, "monitor_recorded_apis.txt")

    benign_labeled_tainted_groups_path = os.path.join(
        __data_demo_inputs_path, "benign_fmt.txt")

    malicious_labeled_tainted_groups_path = os.path.join(
        __data_demo_inputs_path, "malicious_fmt.txt")

    all_labeled_tainted_groups_path = os.path.join(
        __data_demo_inputs_path, "all_fmt_new.txt")
    
    all_labeled_tainted_groups_multiIMG_path = os.path.join(
        __data_demo_inputs_path, "all_fmt_multiIMG.txt")

    all_filtered_labeled_tainted_groups_path = os.path.join(
        __data_demo_inputs_path, "all_filtered.txt")


    all_train_labeled_tainted_groups_multiIMG_path = os.path.join(
        __data_demo_inputs_path, "all_multiIMG_train.txt")

    all_test_labeled_tainted_groups_multiIMG_path = os.path.join(
        __data_demo_inputs_path, "all_multiIMG_test.txt")


    all_filter_train_labeled_tainted_groups_multiIMG_path = os.path.join(
        __data_demo_inputs_path, "all_filter_multiIMG_train.txt")

    all_filter_test_labeled_tainted_groups_multiIMG_path = os.path.join(
        __data_demo_inputs_path, "all_filter_multiIMG_test.txt")


    # > path to save model
    __data_model_path = os.path.join(data_root, "models")
    prediction_model_directory = __data_model_path

    feature_model_directory = os.path.join(prediction_model_directory,
                                           "feature")
