'''
Created on 16-Apr-2021

@author: rishi_priyansh
'''

import random
import inspect
import traceback

from ..helper import BaseHelper

from xv.km.managers import BaseManager
from xv.km.kelements import KProblemTemplate
        
class PhotonManager(BaseManager):
    '''
    PhotonManager
    Example:
        ke = PhotonManager()
        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(PhotonManager, cls).__new__(cls, *args, **kwargs)
        for base_class in PhotonManager.__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_topics',
            ])
        pass



    def _problem_topics(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        
        statement = f"""
        1.  Define the following terms:
                continuous spectrum ( or electromagnetic radiation)
                excited state
                ground state
                line-emission spectrum (p. 94)
                orbital
                photoelectric effect
                photon
                quanta of energy (plural: quantum)    
        2.  If the wavelength of radiation for a specific energy is doubled, what happens to the     frequency?
        3.  If the frequency of radiation for a specific energy is doubled, what happens to the energy?
        4.  Draw a picture of the Bohr model of the hydrogen atom showing the excited and ground     states; show how a photon of light energy is released in the picture.
        5.  What is so unique about the line emission spectra of an element?
        
        """
        problemTemplate.add_problem(statement.strip(), 'text/html')

        
        soln_s = f"""
        
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')

        return problemTemplate
        pass
    
    