'''
Created on 4-Jan-2023

@author: b thakur

'''

import random
import inspect
import traceback

from ..helper import BaseHelper

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

from sympy import UnevaluatedExpr as ueval
from sympy import latex



# _physics_a_level_manager
# PhysicsALevelManager

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


    def _init_problem_types(self, *args, **kwargs):
        self._append_problem_types([
            
            '_problem_particles_in_motion',
            '_problem_newtons_laws',
            '_problem_collision_mechanics',
            '_problem_work_and_energy',
            '_problem_rotation',
            '_problem_gravitation',
            '_problem_simple_harmonic_motion',

            '_problem_fluid_mechanics',
            '_problem_thermodynamics_of_gases',
            '_problem_electrostatic',
            '_problem_electric_circuits',
            '_problem_electromagnetism',
            '_problem_optics',
            '_problem_atomic_physics',

            
            ])
        pass

        
    def _problem_particles_in_motion(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "particles_in_motion.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)





    def _problem_newtons_laws(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "newtons_laws.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)





    def _problem_collision_mechanics(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "collision_mechanics.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)





    def _problem_work_and_energy(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "work_and_energy.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)





    def _problem_rotation(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "rotation.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)





    def _problem_gravitation(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "gravitation.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)





    def _problem_simple_harmonic_motion(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "simple_harmonic_motion.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)


        
    def _problem_fluid_mechanics(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "fluid_mechanics.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)



        
    def _problem_thermodynamics_of_gases(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "thermodynamics_of_gases.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)




    def _problem_electrostatic(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "electrostatic.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)


    def _problem_electric_circuits(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "electric_circuits.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)




        
    def _problem_electromagnetism(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "electromagnetism.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)




        
    def _problem_optics(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "optics.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)



        
    def _problem_atomic_physics(self, *args, **kwargs):
        """
        
        """
        
        folder_path = "question_bank/physics/a_level"
        search_file_paths = [
                "atomic_physics.txt"
            ]
        
        file_paths = self.get_q_bank_factory().search_question_bank_files(folder_path, search_file_paths)
        return self.get_q_bank_factory().PROBLEM_TEMPLATE_Q_BANK_RANDOM_QUESTION(file_paths, *args, **kwargs)


