"""
This class refactors the default parsing class (better & streamlined implementation)
"""
from multiprocessing import Process, RLock
import os
import json



class parser (Process) :
    _CONFIGURATION = {}
    def __init__(self,path=None) :
        if not parser._CONFIGURATION :
            _path = path if path else os.sep.join([os.environ['HOME'],'.healthcareio/config.json'])
            #
            # @TODO: Load custom configuration just in case we need to do further processing
            config = json.loads(open(path).read())
            parser._CONFIGURATION = config['parser']
            #
            # do we have a custom configuration in this location
            #
            _custompath = _path.replace('config.json','')
            _custompath = _custompath if not _custompath.endswith(os.sep) else _custompath[:-1]
            _custompath = os.sep.join([_custompath,'custom'])
            if os.exists(_custompath) :
                files = os.listdir(_custompath)
                if files :
                    _filename = os.sep.join([_custompath,files[0]])
                    _customconf = json.loads(open(_filename).read())
                    #
                    # merge with existing configuration

            
        else:
            pass

        #
        #
    class getter :
        def value(self,) :
            pass
    class setter :
        def files(self,files):
            pass
        