'''
Created on 02-Aug-2023
@author: bthakur


'''
import random
import inspect
import traceback

from ..helper import BaseHelper

from xv.km.managers import BaseManager
from xv.km.kelements import KProblemTemplate



# _physics_comprehension_manager
# PhysicsComprehensionManager

# _high_school_physics_manager
# PhysicsComprehensionManager

        
class PhysicsComprehensionManager(BaseManager):
    '''
    PhysicsComprehensionManager
    Example:
        ke = PhysicsComprehensionManager()
        ke.getRandomProblem()
        ke.getRandomProblem(problem_type = 0)
        ...
        
        ke.printProblem()
        ke.printAnswer()
        ke.printSolution()
        
        ke.printProblemTypes()
        
    '''    
    _OPR_TYPE_COUNT = 10
    
    def __new__(cls, *args, **kwargs):
        instance = super(PhysicsComprehensionManager, cls).__new__(cls, *args, **kwargs)
        for base_class in PhysicsComprehensionManager.__bases__:
            base_class.__init__(instance, *args, **kwargs)
        return instance
    
    def __init__(self, *args, **kwargs):
        self.base_helper = BaseHelper(**kwargs)
        
        self._init_proplem_types_from_question_bank_files()
        pass

    def _init_proplem_types_from_question_bank_files(self, *args, **kwargs):
        '''
        '''
        
        folder_path = "comprehension/physics"
        self.get_comp_factory().add_problem_types_from_a_folder(self, folder_path, search = None, regex = False)
        pass
    
    
    def _init_problem_types(self, *args, **kwargs):
        '''
        this will be initialized by _init_question_bank method
        _init_question_bank creates lambda functions which are defined in ComprehensionFactory.add_problem_types_from_a_folder
        These functions are loaded in memory and call ComprehensionFactory._problem_type_function_for_file
        
        To debug, you can check with the follwing code. Replace <<PROBLEM_TYPE_METHOD>> with appropriate method.
        
        from xv.util import get_runnable_function_source_code
        source_code = get_runnable_function_source_code(<<PROBLEM_TYPE_METHOD>>, strip_tab = True)
        print(source_code)

        '''
        self._append_problem_types([
            ])
        pass
    
