'''
Created on 07-Feb-2021

https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference

@author: bthakur
'''
import random
import inspect
import traceback
from sympy import (symbols, Symbol, latex, pi, solve)
import sympy

from ..helper import LawOfProportionHelper
        
from xv.km.managers import BaseEquationManager #includes BaseManager
from xv.km.kelements import KProblemTemplate
        
class LawOfProportionManager(BaseEquationManager):
    '''
    Principle of proportionality


    Minimum Grade: 4
    Maximum Grade: 10


    Examples
    --------
    ke = LawOfProportionManager()
    ke 
    
    ke.printProblemTypes()
    ke.helpProblemType(0)
    
    ke.getRandomProblem()
    ke.getRandomProblem(problem_type = 0)
    ke.getRandomProblem(problem_type = 0, search = 'work')


    ke.printProblem()
    ke.printAnswer()
    ke.printSolution()


    doc_style: xv_doc
    ''' 

    def __new__(cls, *args, **kwargs):
        instance = super(LawOfProportionManager, cls).__new__(cls, *args, **kwargs)
        for base_class in LawOfProportionManager.__bases__:
            base_class.__init__(instance, *args, **kwargs)
        return instance
    
    def __init__(self, *args, **kwargs):
        self.proportion_helper = None
        pass

    #overwritten
    def get_equation_helper(self):
        if self.proportion_helper is None:
            self._init_proportion_helper()
        return self.proportion_helper
        pass

    def _init_proportion_helper(self):  
        self.proportion_helper = LawOfProportionHelper(verbose = self.verbose)
        pass
   

    def _init_problem_types(self, *args, **kwargs):
        self._append_problem_types(
            [
                #implemented in xv.km.managers.BaseEquationManager
                '_problem_random_computation',
                
                #implemented in xv.km.managers.BaseEquationManager
                '_problem_random_proportional_relation',
                
                #implemented in xv.km.managers.BaseEquationManager
                '_problem_random_proportional_computation',
                
            ])
        pass

