'''
Created on 12-Jul-2021

@author: rishi_priyansh
'''
import inspect
import traceback
import random
import pandas as pd

from xv.util.data import Repository
from xv.util import FileSystemManager

from xv.km import StoredMcqBuilder, StoredSaqBuilder

# _base_topic_helper
# BaseTopicHelper

from xv.util import UtilClass

class BaseTopicHelper(UtilClass):
    '''
    '''
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self._saqs_data = None
        self._stored_mcq_builder = None
        self._stored_saq_builder = None
        
        pass

    def get_stored_mcq_builder(self):
        if self._stored_mcq_builder is None:
            self._init_stored_mcq_builder()
        return self._stored_mcq_builder
        pass  
    
    def _init_stored_mcq_builder(self):
        file_path = self.__class__._MCQ_FILE_PATH
        stored_mcq_builder = StoredMcqBuilder(file_path = file_path,
                                              verbose = self.verbose)
        self._stored_mcq_builder = stored_mcq_builder
        pass

    def random_mcq_question(self, **kwargs):
        stored_mcq_builder = self.get_stored_mcq_builder()
        return stored_mcq_builder.get_random_question(**kwargs)
        pass

            
    def get_stored_saq_builder(self):
        if self._stored_saq_builder is None:
            self._init_stored_saq_builder()
        return self._stored_saq_builder
        pass  
    
    def _init_stored_saq_builder(self):
        file_path = self.__class__._SHORT_ANSWER_QUESTIONS_FILE_PATH
        stored_saq_builder = StoredSaqBuilder(file_path = file_path,
                                              verbose = self.verbose)
        self._stored_saq_builder = stored_saq_builder
        pass

    def random_saq_question(self, **kwargs):
        stored_saq_builder = self.get_stored_saq_builder()
        return stored_saq_builder.get_random_question(**kwargs)
        pass

    def _log_DELETED(self, sOut, to_print = None):
        if to_print is None:
            to_print = self.verbose
            
        if to_print:
            print(sOut)

    pass
#class BaseTopicHelper:

    