'''
Created on 19-Apr-2024

@author: bthakur
'''
import random
import inspect
import traceback
import re

from sympy import (symbols, Symbol, limit, latex, Function,
                   Limit, oo, Derivative, simplify,
                   Eq,
                   Derivative, Integral,
                   exp, log, expand_log,
                   Mul, Add, Pow, UnevaluatedExpr,
                   Sum, binomial, factorial, Rational, 
                   UnevaluatedExpr as ueval
                   )

from sympy import (sin, cos, tan, cot, sec, csc,
                   asin, acos, atan, acot, asec, acsc,
                   sinh, cosh, tanh, coth, sech, csch,
                   asinh, acosh, atanh, acoth, asech, acsch,
                   )

import sympy as sp        

from xv.km.util import latex_fraction
from xv.util import UtilClass

# _std_integration_helper
# StdIntegrationHelper

from ._std_integration_base_helper import StdIntegrationBaseHelper


class StdIntegrationHelper(StdIntegrationBaseHelper):
    '''
    integration of standard functions 
    '''    

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        pass


    def get_standrad_integral(self, index = None):
        sInfo = f"""Processing {self.__class__.__name__}.{inspect.stack()[0][3]}: """
        self._log(sInfo.strip())
        
        if index is None:
            random_choices = list(range(1, 4))
    
            identifier = f"{self.__class__.__name__}{id(self)}.{inspect.stack()[0][3]}.random_choices"
            random_choice = self.get_no_repeat_random_choice(identifier, random_choices)
        else:
            random_choice = index
        
        
        if random_choice == 1:
            return self.get_standrad_integral_by_reversal(index = index)
        
        if random_choice == 1:
            return self.get_standrad_integral_by_substitution(index = index)
            
        if random_choice == 2:
            return self.get_standrad_integration_by_parts(index = index)
            
        if random_choice == 3:
            return self.get_standrad_integration_by_parts_in_chain(index = index)
        pass


    def get_standrad_integral_by_reversal(self, index = None):
        reversal_helper = self.get_std_integration_by_reversal_helper()
        return reversal_helper.get_standrad_integral_by_reversal(index = index)

    def get_standrad_integral_by_substitution(self, index = None):
        subs_helper = self.get_std_integration_by_subs_helper()
        return subs_helper.get_standrad_integral_by_substitution(index = index)

    def get_standrad_integration_by_parts(self, index = None):
        by_parts_helper = self.get_std_integration_by_parts_helper()
        return by_parts_helper.get_standrad_integration_by_parts(index = index)
        
    def get_standrad_integration_by_parts_in_chain(self, index = None):
        by_parts_helper = self.get_std_integration_by_parts_helper()
        return by_parts_helper.get_standrad_integration_by_parts_in_chain(index = index)
        
    pass
#class StdIntegrationHelper:
