'''
Created on 04-Jul-2021

@author: rishi_priyansh
'''


import inspect
import traceback
import pathlib

from xv.util import HtmlUtil
from xv.km.helper import WebLinkHelper


from xv.util import UtilClass

class BaseHelper(UtilClass):
    _EXTERNAL_LINKS_FILE_PATH = 'resources/_geo_external_links.csv'
    
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self._web_link_helper = None
        self._map_helper = None
        self._earth_helper = None
        
        self._kwargs = kwargs
        
        self.htmlUtil = HtmlUtil()
        pass


    def get_web_link_helper(self):
        if self._web_link_helper is None:
            self._init_web_link_helper(**self._kwargs)
            
        return self._web_link_helper
        pass

    def _init_web_link_helper(self, **kwargs):  
        file_path = BaseHelper._EXTERNAL_LINKS_FILE_PATH
        root_folder = pathlib.Path(__file__).parent.absolute()

        self._web_link_helper = WebLinkHelper(file_path = file_path,
                                              root_folder = root_folder,
                                              verbose = self.verbose)
        pass
    

    def get_map_helper(self):
        if self._map_helper is None:
            self._init_map_helper(**self._kwargs)
        return self._map_helper
        pass

    def _init_map_helper(self, **kwargs):  
        from ._map_helper import MapHelper
        self._map_helper = MapHelper(**kwargs)
        pass
    
            
    def get_earth_helper(self):
        if self._earth_helper is None:
            self._init_earth_helper(**self._kwargs)
        return self._earth_helper
        pass

    def _init_earth_helper(self, **kwargs):  
        from ._earth_helper import EarthHelper
        self._earth_helper = EarthHelper(**kwargs)
        pass
    
            
    pass
#class BaseHelper:
