u'''
This module is an example Arelle controller in non-interactive mode

@author: Mark V Systems Limited
(c) Copyright 2011 Mark V Systems Limited, All rights reserved.
'''
from arelle import Cntlr

# this is the controller class
class CntlrValidateExample(Cntlr.Cntlr):

    # init sets up the default controller for logging to a file (instead of to terminal window)
    def __init__(self):
        # initialize superclass with default file logger
        super(self.__class__, self).__init__(logFileName=u"c:\\temp\\test-log.txt", logFileMode=u"w")
        
    def run(self):
        # create the modelXbrl by load instance and discover DTS
        modelXbrl = self.modelManager.load(u"c:\\temp\\test.xbrl")

        # select validation of calculation linkbase using infer decimals option            
        self.modelManager.validateInferDecimals = True
        self.modelManager.validateCalcLB = True

        # perfrom XBRL 2.1, dimensions, calculation
        self.modelManager.validate()
         
        # close the loaded instance
        self.modelManager.close()
        
        # close controller and application
        self.close()
            
# if python is initiated as a main program, start the controller
if __name__ == u"__main__":
    # create the controller and start it running
    CntlrValidateExample().run()
